Check lighttpd.conf on restart

Bug #286887 reported by rvdm
6
Affects Status Importance Assigned to Milestone
lighttpd (Debian)
Fix Released
Unknown
lighttpd (Ubuntu)
Fix Released
Wishlist
Daniel Hahler

Bug Description

Binary package hint: lighttpd

Description: Ubuntu 8.04.1
Release: 8.04

rvdm@serpent:~$ apt-cache policy lighttpd
lighttpd:
  Installed: 1.4.19-0ubuntu3
  Candidate: 1.4.19-0ubuntu3
  Version table:
 *** 1.4.19-0ubuntu3 0
        500 http://nl.archive.ubuntu.com hardy/universe Packages
        100 /var/lib/dpkg/status

When restarting lighty using /etc/init.d/lighttpd restart, the lighttpd.conf is not checked. This results in a non-running webserver if there are typo's in the configuration file(s).
As lighttpd configuration can be quite complicated, it would be advisable to do checking similar to the checks used in the apache packages. Lighttpd supports a configuration check using the lighttpd -t command.
I just wanted to report this to get it out of my head; If patches are required, I'd be happy to supply them.

Related branches

Revision history for this message
Nic Ferrier (nferrier) wrote :

I'd like to endorse this... here's the diff from our patched version:

--- lighttpd 2009-02-11 00:50:12.000000000 -0800
+++ changed 2009-02-11 00:57:36.000000000 -0800
@@ -31,8 +31,15 @@

 . /lib/lsb/init-functions

+function syntax_check
+{
+$DAEMON $DAEMON_OPTS -t
+[ $? -ne 0 ] || exit 1
+}
+
 case "$1" in
   start)
+ syntax_check
  log_daemon_msg "Starting $DESC" $NAME
  if ! $ENV $SSD --start --quiet\
  --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS ; then
@@ -52,6 +59,7 @@
  fi
  ;;
   reload)
+ syntax_check
  log_daemon_msg "Reloading $DESC configuration" $NAME
  if $SSD --stop --signal 2 --oknodo --retry 30\
  --quiet --pidfile $PIDFILE --exec $DAEMON; then
@@ -66,6 +74,7 @@
  fi
   ;;
   restart|force-reload)
+ syntax_check
  $0 stop
  [ -r $PIDFILE ] && while pidof lighttpd |\
    grep -q `cat $PIDFILE 2>/dev/null` 2>/dev/null ; do sleep 1; done

## ENDS

Revision history for this message
Daniel Hahler (blueyed) wrote :

Please attach a patch the next time, since I had to manually "apply" it now.
I've used "DAEMON $DAEMON_OPTS -t || exit 1" for syntax_check now - hope that's OK.

Changed in lighttpd:
assignee: nobody → blueyed
status: New → In Progress
importance: Undecided → Wishlist
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lighttpd - 1.4.19-5ubuntu3

---------------
lighttpd (1.4.19-5ubuntu3) jaunty; urgency=low

  * init.d: check sytax during start/reload/restart/force-reload.
    Patch provided by Nic Ferrier. (LP: #286887)

 -- Daniel Hahler <email address hidden> Sat, 14 Feb 2009 22:18:35 +0100

Changed in lighttpd:
status: In Progress → Fix Released
Revision history for this message
Scott Kitterman (kitterman) wrote :

The above fix failed to build. I'll upload a new revision shortly that fixes that.

Revision history for this message
Daniel Hahler (blueyed) wrote :

Just for reference, there had been more uploads as follow-up: see bug 329595.

Daniel Hahler (blueyed)
Changed in lighttpd (Debian):
importance: Undecided → Unknown
status: New → Unknown
Changed in lighttpd (Debian):
status: Unknown → New
Changed in lighttpd (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.