File: init.d

package info (click to toggle)
lighttpd 1.4.13-4etch12
  • links: PTS
  • area: main
  • in suites: etch
  • size: 4,480 kB
  • ctags: 3,537
  • sloc: ansic: 37,630; sh: 8,915; perl: 2,215; yacc: 584; makefile: 374; php: 9
file content (73 lines) | stat: -rw-r--r-- 1,582 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh
### BEGIN INIT INFO
# Provides:          lighttpd
# Required-Start:    networking
# Required-Stop:     networking
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start the lighttpd web server.
### END INIT INFO


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

DAEMON_OPTS="-f /etc/lighttpd/lighttpd.conf"

test -x $DAEMON || exit 0

set -e

. /lib/lsb/init-functions

case "$1" in
  start)
	log_daemon_msg "Starting $DESC" $NAME
	if ! start-stop-daemon --start --quiet\
	--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\
	--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\
	--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
	[ -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