[systemd-devel] Back trace systemd service unit by pid
Kevin Hsu
hsukvn at gmail.com
Fri Dec 22 09:56:52 UTC 2017
Hi folks,
First of all thanks for all good answers. After looking deep how the "ps"
command gets the unit name, I found out that it uses function
"sd_pid_get_unit" from
systemd/sd-login.h in libsystemd.so. So I decide to use it as well. Thanks
a lot.
Best wishes,
Kevin
2017-12-21 23:05 GMT+08:00 Tomasz Torcz 👁️ <tomek at pipebreaker.pl>:
> On Thu, Dec 21, 2017 at 01:48:29PM +0800, Kevin Hsu wrote:
> > Hi folks,
> >
> > I am looking for a good way to backtrace systemd service by a process id.
> > The "systemctl status <pid>" command is available to do the magic. It
> will
> > show a full status of the service that creates the
> > pid. But this command gives too many details. The only thing I need is
> the
> > service unit name. Is there any simple way instead of parsing results
> from
> > "systemctl status" ?
> >
> > For example like
> >
> > > systemctl service-get 5566
> > > nginx.service
>
>
> Look into /proc/<pid>/cgroup
>
> --
> Tomasz Torcz Once you've read the dictionary,
> xmpp: zdzichubg at chrome.pl every other book is just a remix.
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20171222/a0df3010/attachment.html>
More information about the systemd-devel
mailing list