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

Alexander E. Patrakov patrakov at gmail.com
Tue Jan 11 07:11:29 PST 2011

11.01.2011 19:46, Marius Tolzmann wrote:
> hi again..
> On 01/11/11 11:51, Alexander E. Patrakov wrote:
>> If you also want graceful stop, you may want to add:
>> ExecStop=/bin/kill -INT $MAINPID
>> but this doesn't work, as lighttpd gets killed immediately. I don't know
>> why this happens.
> have you tried KillMode=process here?


>> 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?

Alexander E. Patrakov

More information about the systemd-devel mailing list