[systemd-devel] Support for pre-restart check

Ansgar Burchardt ansgar at debian.org
Wed Jul 30 04:42:52 PDT 2014


Hi,

On 07/30/2014 13:26, "Jóhann B. Guðmundsson" wrote:
> On 07/30/2014 10:22 AM, Ansgar Burchardt 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 discussed before and check the archive for that discussion
> but the bottom line is that this is not needed we already have
> ExecStartPre=, ExecStartPost=, ExecStop=, ExecStopPost=, or ExecReload=
> which cover those usecases

I searched for such discussion, but did not find anything relevant. Do
you have a link?

And how would you use the existing Exec* options to cover this usecase?
ExecStart* certainly doesn't help, ExecReload only works for reload and
not for restart.  ExecStop is to actually stop the service (and should
not fail due to invalid configuration); ExecStopPost is too late.

Ansgar



More information about the systemd-devel mailing list