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

2017-12-22 Thread Kevin Hsu
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

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

2017-12-21 Thread Tomasz Torcz ️
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 " command is available to do the magic. It will > show a full status of the service that creates the > pid. But this command

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

2017-12-21 Thread Lennart Poettering
On Do, 21.12.17 13:48, Kevin Hsu (hsu...@gmail.com) wrote: > Hi folks, > > I am looking for a good way to backtrace systemd service by a process id. > The "systemctl status " command is available to do the magic. It will > show a full status of the service that creates the > pid. But this

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

2017-12-20 Thread aleivag
the simplest way is to use busctl as aleivag@algx:~$ busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager GetUnitByPID u 28729 o "/org/freedesktop/systemd1/unit/nginx_2eservice" from that you are a awk away of what you want. if you want to get clever

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

2017-12-20 Thread Kevin Hsu
Hi folks, I am looking for a good way to backtrace systemd service by a process id. The "systemctl status " 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