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

Marius Tolzmann tolzmann at molgen.mpg.de
Tue Jan 11 06:46:01 PST 2011

hi again..

On 01/11/11 11:51, Alexander E. Patrakov wrote:
> After more research, I found the under-documented lighttpd-angel
> program. It does what is needed for babysitting lighttpd: performs the
> "send SIGINT to the old copy and immediately start the new one" dance
> when it receives SIGHUP. See
> http://blog.lighttpd.net/articles/2007/09/02/there-is-an-angel-for-lighty .
> So here is a working unit file for lighttpd, with graceful reloading:

i found this too but thought is was only intended to be included in 
versions 1.5+ of lighttpd.. after compiling and installing the latest 
lighttpd to test the systemd unit i was happy that the "angel" is 
already shipped in the 1.4.x series.. 8)

> 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.
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..)

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?

bye.. marius..

More information about the systemd-devel mailing list