| 1 | #! /bin/sh |
|---|
| 2 | # |
|---|
| 3 | # skeleton example file to build /etc/init.d/ scripts. |
|---|
| 4 | # This file should be used to construct scripts for /etc/init.d. |
|---|
| 5 | # |
|---|
| 6 | # Written by Miquel van Smoorenburg <miquels@cistron.nl>. |
|---|
| 7 | # Modified for Debian |
|---|
| 8 | # by Ian Murdock <imurdock@gnu.ai.mit.edu>. |
|---|
| 9 | # |
|---|
| 10 | # Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl |
|---|
| 11 | # |
|---|
| 12 | |
|---|
| 13 | PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin |
|---|
| 14 | DAEMON=/usr/sbin/lighttpd |
|---|
| 15 | OPTS="-f /etc/lighttpd/lighttpd.conf" |
|---|
| 16 | NAME=lighttpd |
|---|
| 17 | DESC=lighttpd |
|---|
| 18 | |
|---|
| 19 | test -x $DAEMON || exit 0 |
|---|
| 20 | |
|---|
| 21 | # Include lighttpd defaults if available |
|---|
| 22 | if [ -f /etc/default/lighttpd ] ; then |
|---|
| 23 | . /etc/default/lighttpd |
|---|
| 24 | fi |
|---|
| 25 | |
|---|
| 26 | set -e |
|---|
| 27 | |
|---|
| 28 | case "$1" in |
|---|
| 29 | start) |
|---|
| 30 | echo -n "Starting $DESC: " |
|---|
| 31 | start-stop-daemon --start --quiet \ |
|---|
| 32 | --pidfile /var/run/$NAME.pid --exec $DAEMON -- $OPTS |
|---|
| 33 | echo "$NAME." |
|---|
| 34 | ;; |
|---|
| 35 | stop) |
|---|
| 36 | echo -n "Stopping $DESC: " |
|---|
| 37 | if start-stop-daemon --stop --pidfile /var/run/$NAME.pid \ |
|---|
| 38 | --exec $DAEMON; then |
|---|
| 39 | rm -f /var/run/$NAME.pid |
|---|
| 40 | echo "$NAME." |
|---|
| 41 | fi |
|---|
| 42 | ;; |
|---|
| 43 | reload) |
|---|
| 44 | # |
|---|
| 45 | # If the daemon can reload its config files on the fly |
|---|
| 46 | # for example by sending it SIGHUP, do it here. |
|---|
| 47 | # |
|---|
| 48 | # If the daemon responds to changes in its config file |
|---|
| 49 | # directly anyway, make this a do-nothing entry. |
|---|
| 50 | # |
|---|
| 51 | echo "Reloading $DESC configuration files." |
|---|
| 52 | start-stop-daemon --stop --signal 1 --quiet --pidfile /var/run/$NAME.pid \ |
|---|
| 53 | --exec $DAEMON |
|---|
| 54 | ;; |
|---|
| 55 | restart|force-reload) |
|---|
| 56 | # |
|---|
| 57 | # If the "reload" option is implemented, move the "force-reload" |
|---|
| 58 | # option to the "reload" entry above. If not, "force-reload" is |
|---|
| 59 | # just the same as "restart". |
|---|
| 60 | # |
|---|
| 61 | echo -n "Restarting $DESC: " |
|---|
| 62 | start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/$NAME.pid \ |
|---|
| 63 | --exec $DAEMON |
|---|
| 64 | rm -f /var/run/$NAME.pid |
|---|
| 65 | sleep 1 |
|---|
| 66 | start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ |
|---|
| 67 | --exec $DAEMON -- $OPTS |
|---|
| 68 | echo "$NAME." |
|---|
| 69 | ;; |
|---|
| 70 | *) |
|---|
| 71 | N=/etc/init.d/$NAME |
|---|
| 72 | echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 |
|---|
| 73 | #echo "Usage: $N {start|stop|restart|force-reload}" >&2 |
|---|
| 74 | exit 1 |
|---|
| 75 | ;; |
|---|
| 76 | esac |
|---|
| 77 | |
|---|
| 78 | exit 0 |
|---|