> This also fails, the following works:
> 
> systemctl reload lighttpd.service > /dev/null 2>&1;

That will start lighttpd if it is not running, which might not be
desirable.  I think that a different solution is warranted.

/etc/logrotate.d/lighttpd is doing the correct thing, calling
  /etc/init.d/lighttpd reopen-logs

However, perhaps /etc/init.d/lighttpd should avoid sending a signal to
lighttpd to reopen logs if lighttpd is not running.
/etc/init.d/lighttpd might check using pidofproc, even though
running start-stop-daemon --oknodo --quiet should have exited 0
if nothing was running.

Does the following work for you?

@@ -92,6 +92,7 @@ case "$1" in
         fi
         ;;
     reopen-logs)
+        pidofproc -p "$PIDFILE" "$DAEMON" >/dev/null 2>&1 || exit 0
         log_daemon_msg "Reopening $DESC logs" $NAME
         if start-stop-daemon --stop --signal HUP --oknodo --quiet \
             --pidfile $PIDFILE --exec $DAEMON

Reply via email to