[systemd-devel] restart vs. stop/start

Christian Boltz systemd-devel at cboltz.de
Fri May 20 19:50:31 UTC 2016


Hello,

it looks like
    systemctl restart foo
is internally mapped to a sequence of
    systemctl stop foo; systemctl start foo

Unfortunately, this behaviour causes quite some trouble for me.

I need a way to know if "restart "or "stop" was used because the mapping 
to stop / start gives my service a completely different behaviour than 
expected on restart.

Is there a way to find out if "stop" or "restart" was used?

I remember a similar question in January [1], but to make things more 
interesting, I need this for a Type=oneshot service, which means I can't 
play games like keeping file descriptors open.

Any ideas how I can differentiate between restart and stop?


An alternative solution would be to disallow using restart (reload 
would be enough for me and behaves the correct way), but I didn't find 
a way to forbid restart. (Or did I overlook it? The manpagesare long and 
detailed (thanks for that!), but that makes it easy to overlook something ;-)


Regards,

Christian Boltz

[1] https://lists.freedesktop.org/archives/systemd-devel/2016-January/035577.html
-- 
what does "> /dev/null" mean?
and how do i reverse it?
would "< /dev/null" be right?
[aus comp.unix.shell]



More information about the systemd-devel mailing list