[systemd-devel] Support for pre-restart check

Colin Guthrie gmane at colin.guthr.ie
Wed Jul 30 17:16:18 PDT 2014


Reindl Harald wrote on 30/07/14 13:34:
> *how* should that both help in calling "apachectl -t" *before* stop the
> service and in case of a error-repsonse keep it running?

Note, just for clarity, you don't really want to run such a config test
when explicitly stopping a service - that should always succeed IMO
(unless you think that "systemctl kill ..." should be used in such
circumstances?)

> "ExecStopPre" would be better suited as the pre-restart check because
> it would achieve the goal and also prevent stop a service until it's
> configuration is fixed - that catchs cases where you stop something
> for whatever reason and expect it would be started at the next boo

I really think an ExecRestartPre (or perhaps a more explicit
ExecRestartCheck) would be a more sensible name (ExecStopPre implies it
would run when explicitly stopping which, as noted above, I think is a
bad plan). It wouldn't run when an ExecReload is given explicitly but if
that operation falls back to restart, it would.

I think the use case is pretty clear tho'. Config (or general machine
state) has transitioned from working to broken in the time since the
service was started and while it's really not a nice situation to find
yourself in (relying on a running service not crashng!), this at least
helps avoid nasty consequences for the most part while you work to fix
things.

Col



-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/


More information about the systemd-devel mailing list