Project

General

Profile

Actions

InitScriptDebian » History » Revision 1

Revision 1/3 | Next »
Anonymous, 2011-04-11 19:07


Init.d with LSB tags

#! /bin/sh
### BEGIN INIT INFO
# Provides:          lighttpd
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Lighttpd2 init script
# Description:       Starts lighttpd2 web server
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=lighttpd2
DESC=lighttpd2
PIDFILE=/var/run/$NAME.pid
DAEMON=/usr/sbin/lighttpd2/lighttpd2
DAEMON_OPTS="--config /etc/lighttpd2/angel.conf" 

test -x $DAEMON || exit 0

set -e

case "$1" in
    start)
        echo -n "Starting $DESC: " 
        start-stop-daemon --start --quiet --background --exec $DAEMON -- $DAEMON_OPTS
        echo "$NAME." 
        ;;
    stop)
        echo -n "Stopping $DESC: " 
        start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
        echo "$NAME." 
        rm -f $PIDFILE
        ;;

    restart|force-reload)
    #
    #   If the "reload" option is implemented, move the "force-reload" 
    #   option to the "reload" entry above. If not, "force-reload" is
    #   just the same as "restart".
    #
        echo -n "Restarting $DESC: " 
        start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
        sleep 1
        start-stop-daemon --start --quiet --background --exec $DAEMON -- $DAEMON_OPTS
        echo "$NAME." 
        ;;
    *)
        N=/etc/init.d/$NAME
    # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac

exit 0

Updated by over 13 years ago · 1 revisions