[systemd-devel] lighttp unit - graceful reload of configfiles by sending signal to $MAINPID

Mirco Tischler mt-ml at gmx.de
Tue Jan 11 07:50:56 PST 2011


Am 11.01.2011 16:11, schrieb Alexander E. Patrakov:
>> Also, the "test config before reloading" feature still doesn't work
>>> right. If I add this ExecReload line before the existing one:
>>>
>>> ExecReload=/usr/sbin/lighttpd -t -f /etc/lighttpd/lighttpd.conf
>>>
>>> then systemd will kill lighttpd-angel when the configuration file is
>>> bad. It should instead complain to syslog and do nothing with the
>>> running instances of lighttpd and lighttpd-angel.
>>
>> The behaviour seems to be undocumented (at least i havn't found
>> anything) if the ExecReload= command fails.
>>
>> But if a reload fails it makes sense to me to stop a service because
>> this service wouldn't be in the state the caller wants it to be.
>
>
> In this case, it doesn't make sense, because the service is still in a
> known state (the old state) that is still better than the non-running
> state from the viewpoint of avoiding downtime.
>
>> There is no way you can notify systemd that the failed reload attempt
>> was just a test prior to executing the real reload command (e.g.
>> there is no ExecReloadPre or the like). (If a service keeps running I
>> won't check syslog..)
>
> When the config is bad and the additional ExecReload line is present,
> systemd does tell me that reload failed. So I have a good reason to
> check syslog, and even am suggested by systemd to do so.
>
>>
>> At last: Isn't that something lighttpd should take care off? Or the
>> user should test before issuing a reload? Or a small script can do?
>
> Isn't one of the points of systemd to eliminate such small scripts?
>
I just implemented an additional command: ExecConfigTest, which could
solve your issues. This is just a very quick first version and I'm sure
I've done something wrong or oversaw somethin although in a quick test
it works.
If set, the command is executed prior to those commands: ExecStart or if
exists ExecStartPre, ExecReload and ExecRestart. When failing, on
startup, the server isn't started. On restart and reload failure leads
to the service continuing to run and systemd not executing the
restart/reload command. So downtime because of configuration failures
can be minimized for services which provide a config test command. The
patch will be a followup to this mail. Would this be usefull?

Alexander, I've also thought about your email concerning yesterdays
patch and you have made some valid points. I'm not sure how to fix this
right yet though.

Thanks
Mirco



More information about the systemd-devel mailing list