
Dave Howorth wrote:
On Tue, 09 Jul 2019 21:34:14 +0200 Per Jessen <per@computer.org> wrote:
Dave Howorth wrote:
On Tue, 9 Jul 2019 20:57:12 +0300 Andrei Borzenkov <arvidjaar@gmail.com> wrote:
09.07.2019 20:12, Per Jessen пишет:
Andrei Borzenkov wrote:
09.07.2019 17:50, Per Jessen пишет: > Per Jessen wrote: > for testing whether a process is running under systemd - is > getppid()==1 a good idea?
Do you mean "if /sbin/init is systemd" or "if program is running as system service as opposed to being launched by user"?
The latter - "if program is running as system service as opposed to being launched by user".
I do not think there is any reliable way to check it. Any double forked program will be reparented to init:
What about "ps -eo pid,comm,cgroup | grep firefox" or some similar mantra to check the cgroup as described at
In C please :-)
Now you want me to do your coding for you as well, already? :)
I'm outsourcing .... Interesting thing with the cgroup, but does it hold up - a systemd unit could easily have its own cgroup? Mine don't though ps -eo pid,comm,cgroup | grep ibwd 27607 ibwd 11:devices:/system.slice/bwid.service,8:pids:/system.slice/bwid.service,1:name=systemd:/system.slice/bwid.service,0::/system.slice/bwid.service -- Per Jessen, Zürich (15.9°C) http://www.hostsuisse.com/ - dedicated server rental in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org