Reload in init.d script for debian
Since lighty now does a graceful shutdown, the "reload config" functionality in the init script should now work. Here is a patch that does it on debian:
svijaykr@ubuntu:~/work$ diff -urN lighttpd-1.4.3/debian/init.d exp/lighttpd-1.4.4/debian/init.d --- lighttpd-1.4.3/debian/init.d 2005-08-11 03:56:59.000000000 +0530 +++ exp/lighttpd-1.4.4/debian/init.d 2005-09-14 23:14:15.934780168 +0530 @@ -48,10 +48,17 @@ # If the daemon responds to changes in its config file # directly anyway, make this a do-nothing entry. # + + # A SIGINT causes lighty to reload the config file + echo "Reloading $DESC configuration files." - start-stop-daemon --stop --signal 1 --quiet --pidfile /var/run/$NAME.pid \ + start-stop-daemon --stop --signal 2 --quiet --pidfile /var/run/$NAME.pid \ --exec $DAEMON + sleep 5 + start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON -- $OPTS + echo "$NAME." ;; + restart|force-reload) # # If the "reload" option is implemented, move the "force-reload"
Updated by Anonymous over 16 years ago
I've attached an alternate patch for reload. The original patch waits 5 seconds for the old lighttpd to die. During this time, new connections are not accepted. And, there's no guarantee 5 seconds is enough; on high load systems, it may take minutes for old connections to time out.
Instead, send -INT, immediately remove the old pid file, and start a new lighttpd. Wait only 1 second to be sure that on high-load systems the old lighttpd really did release its sockets.
This patch seems to work fine on our production systems.
Also available in: Atom