Bug im InitScript von Lighttpd in Lenny

Hi,

da wir hier gerade auf einer Kiste von apache2 auf Lighttpd umsteigen ist mir beim Konfigurieren folgendes aufgefallen:

Wenn man den Befehl „include_shell“ benutzen möchte, wird $SHELL benötigt. Dafür habe ich das Init Script mal angepasst …

#!/bin/sh
### BEGIN INIT INFO
# Provides:          lighttpd
# Required-Start:    $remote_fs $network
# Required-Stop:     $remote_fs $network
# Should-Start:      fam
# Should-Stop:       fam
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start the lighttpd web server.
### END INIT INFO

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/lighttpd
NAME=lighttpd
DESC="web server"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

CONF_FILE="/etc/lighttpd/lighttpd.conf"
DAEMON_OPTS="-f ${CONF_FILE}"

test -x $DAEMON || exit 0

set -e

# be sure there is a /var/run/lighttpd, even with tmpfs
mkdir -p /var/run/lighttpd > /dev/null 2> /dev/null
# get User and Group names
LIGHTYUSER=$(grep server.username ${CONF_FILE} | awk '{ print $3 }' | tr -d \")
LIGHTYGROUP=$(grep server.groupname ${CONF_FILE} | awk '{ print $3 }' | tr -d \")

if [ -z $LIGHTYUSER ]; then LIGHTYUSER="www-data"; fi
if [ -z $LIGHTYGROUP ]; then LIGHTYGROUP="www-data"; fi

chown ${LIGHTYUSER}:${LIGHTYGROUP} /var/run/lighttpd

chmod 0750 /var/run/lighttpd

. /lib/lsb/init-functions

case "$1" in
    start)
        log_daemon_msg "Starting $DESC" $NAME
        if ! start-stop-daemon --start --quiet --oknodo \
            --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS
        then
            log_end_msg 1
        else
            log_end_msg 0
        fi
        ;;
    stop)
        log_daemon_msg "Stopping $DESC" $NAME
        if start-stop-daemon --quiet --stop --oknodo --retry 30 --oknodo \
            --pidfile $PIDFILE --exec $DAEMON
        then
            rm -f $PIDFILE
            log_end_msg 0
        else
            log_end_msg 1
        fi
        ;;
    reload)
        log_daemon_msg "Reloading $DESC configuration" $NAME
        if start-stop-daemon --stop --signal 2 --oknodo --retry 30 --oknodo \
            --quiet --pidfile $PIDFILE --exec $DAEMON
        then
            if start-stop-daemon --start --quiet  \
                --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS ; then
                log_end_msg 0
            else
                log_end_msg 1
            fi
        else
            log_end_msg 1
        fi
        ;;
    restart|force-reload)
        $0 stop
        test -r  $PIDFILE && while pidof lighttpd | \
            grep -q `cat $PIDFILE 2>/dev/null` 2>/dev/null ; do sleep 1; done
        $0 start
        ;;
    *)
        echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
        exit 1
        ;;
esac

exit 0
Apr 27th, 2009 | Posted in Linux
No comments yet.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>