[systemd-devel] Support for pre-restart check

Reindl Harald h.reindl at thelounge.net
Wed Jul 30 05:34:50 PDT 2014


Am 30.07.2014 14:19, schrieb Jóhann B. Guðmundsson:
> On 07/30/2014 12:09 PM, Lennart Poettering wrote:
>> On Wed, 30.07.14 12:22, Ansgar Burchardt (ansgar at debian.org) wrote:
>>
>>> >while looking at how to convert sysvinit scripts to service files in
>>> >Debian, I noticed that some scripts do an additional sanity check during
>>> >the restart action. That is, they run an extra command to validate the
>>> >configuration and only restart the service on success.
>>> >
>>> >Systemd doesn't seem to provide such an option so far. Would you think
>>> >this is something one would like to see? If yes, what about the
>>> >following idea:
>>> >
>>> >Add an ExecRestartPre option in the [Service] section. These commands
>>> >are executed when a restart is requested, before the service is stopped.
>>> >If they fail, the restart is aborted with an error.
>> This has been a TODO item since a long time. The usecase seems valid.
> 
> We discussed this either here on the mailinglist, in a bug report in bz.rh or in one of the hackfest and it's on
> that TODO list is there because in the beginning I thought this was required but
> after we discussed this the behaviour and after going through the more or less all of the legacy sysv initscripts
> in Fedora simply using ExecStartPre and ExecStop covered this but by all means introduce this if you no longer
> think that is the case

*how* should that both help in calling "apachectl -t" *before* stop the
service and in case of a error-repsonse keep it running?

"ExecStartPre" can only prevent a not or no longer running service
to start again, ExecStopPost comes after it is stopped and a
"ExecStopPre" don't exist

"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 boot

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 246 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20140730/8bf31fcc/attachment-0001.sig>


More information about the systemd-devel mailing list