[systemd-devel] Back trace systemd service unit by pid

Lennart Poettering lennart at poettering.net
Thu Dec 21 10:08:47 UTC 2017


On Do, 21.12.17 13:48, Kevin Hsu (hsukvn at gmail.com) 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

The normal "ps" tool can do that these days:

$ ps hp 5566 -o unit

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list