diff options
authorGlenn Strauss <>2017-01-24 18:40:28 -0500
committerGlenn Strauss <>2017-01-31 14:40:05 -0500
commit0ae6bab4a97f12a0c93200df36ac1741696eeed5 (patch)
parentb63c9011c392a3cb0a2e8df82301e5b6002905c9 (diff)
[doc] SIGUSR1 doc and lighttpd-angel SIGUSR1
lighttpd-angel: add paranoid check to avoid sending kill(-1, <signal>) as root
4 files changed, 22 insertions, 4 deletions
diff --git a/doc/initscripts.txt b/doc/initscripts.txt
index 44ea53f..e6104fa 100644
--- a/doc/initscripts.txt
+++ b/doc/initscripts.txt
@@ -1,9 +1,12 @@
* lighttpd responds to the following signals:
-SIGINT - shut down gracefully (finish serving existing connections and exit)
-SIGTERM - shut down immediately (terminate existing connections and exit)
+SIGTERM - shut down immediately (terminate existing connections, then exit)
+SIGINT - shut down gracefully (serve existing connections, then exit)
+SIGUSR1 - reload gracefully (serve existing connections, then reload config)
SIGHUP - re-open log files (NOTE: does not reload lighttpd configuration)
+(Note: SIGUSR1 behavior is available in lighttpd 1.4.46 and later)
* lighttpd graceful restart
@@ -11,6 +14,10 @@
The current recommended way to reload lighttpd config is to gracefully stop
and then to restart lighttpd.
+With lighttpd 1.4.46 and later, SIGUSR1 is the recommended method to gracefully
+handle configuration reloads and log rotation, though a graceful stop and then
+restart of lighttpd is still required for lighttpd configurations which chroot.
* lighttpd initscripts
@@ -36,5 +43,7 @@
+sample systemd unit script: doc/systemd/lighttpd.service
Additional, updated information may be found at
diff --git a/doc/lighttpd-angel.8 b/doc/lighttpd-angel.8
index ccf394d..dd61b7c 100644
--- a/doc/lighttpd-angel.8
+++ b/doc/lighttpd-angel.8
@@ -11,15 +11,18 @@ lighttpd-angel \- monitor/supervise lighttpd daemon
lighttpd-angel will restart lighttpd if lighttpd exits for any reason, other
than by signals sent by lighttpd-angel.
+Send lighttpd-angel SIGTERM to initiate immediate shutdown of lighttpd.
Send lighttpd-angel SIGINT to initiate graceful shutdown of lighttpd.
-Send lighttpd-angel SIGTERM to initiate shutdown of lighttpd.
+Send lighttpd-angel SIGHUP to initiate graceful restart of lighttpd.
-Send lighttpd-angel SIGHUP to initiate restart of lighttpd, reloading config.
+Send lighttpd-angel SIGUSR1 to initiate graceful reload of lighttpd config.
Online Documentation:
diff --git a/doc/systemd/lighttpd.service b/doc/systemd/lighttpd.service
index e92b160..6dfe44f 100644
--- a/doc/systemd/lighttpd.service
+++ b/doc/systemd/lighttpd.service
@@ -4,8 +4,10 @@
ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf
ExecStart=/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
+ExecReload=/bin/kill -USR1 $MAINPID
diff --git a/src/lighttpd-angel.c b/src/lighttpd-angel.c
index 4c629a6..2b88e55 100644
--- a/src/lighttpd-angel.c
+++ b/src/lighttpd-angel.c
@@ -38,12 +38,15 @@ static void sigaction_handler(int sig, siginfo_t *si, void *context) {
switch (sig) {
case SIGINT:
+ case SIGUSR1:
+ if (pid <= 0) break;
memcpy(&last_sigterm_info, si, sizeof(*si));
/** forward the sig to the child */
kill(pid, sig);
case SIGHUP: /** do a graceful restart */
+ if (pid <= 0) break;
memcpy(&last_sighup_info, si, sizeof(*si));
/** do a graceful shutdown on the main process and start a new child */
@@ -81,6 +84,7 @@ int main(int argc, char **argv) {
sigaction(SIGINT, &act, NULL);
sigaction(SIGTERM, &act, NULL);
+ sigaction(SIGUSR1, &act, NULL);
sigaction(SIGHUP, &act, NULL);
sigaction(SIGALRM, &act, NULL);
sigaction(SIGCHLD, &act, NULL);