File: thttpd.init.d

package info (click to toggle)
thttpd 2.25b-11
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 784 kB
  • ctags: 686
  • sloc: ansic: 8,136; sh: 2,449; makefile: 256
file content (82 lines) | stat: -rw-r--r-- 1,490 bytes parent folder | download
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
74
75
76
77
78
79
80
81
82
#!/bin/sh

### BEGIN INIT INFO
# Provides:          thttpd
# Required-Start:    $network $remote_fs
# Required-Stop:     $network $remote_fs
# Should-Start:
# Should-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Starts tiny/turbo/throttling HTTP server
# Description:       thttpd is a small, fast secure webserver.
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/thttpd
DESC="web server"
NAME=thttpd

DEFAULTS=/etc/default/thttpd
CONFFILE=/etc/thttpd/thttpd.conf
PIDFILE=/var/run/thttpd.pid
OPTIONS="-C $CONFFILE -i $PIDFILE"

test -x $DAEMON || exit 0
test -f $CONFFILE || exit 1


#
#  Read the defaults file if present
#
if [ -s $DEFAULTS ]; then
    . $DEFAULTS

    if [ "x$ENABLED" != "xyes" ]; then
        exit 0
    fi
fi


set -e

case "$1" in
	start)
		echo -n "Starting $DESC: "
		start-stop-daemon -S -q -p $PIDFILE -x $DAEMON --oknodo -- $OPTIONS
		echo "$NAME."
		;;

	stop)
		echo -n "Stopping $DESC: "
		start-stop-daemon -K -q -p $PIDFILE -x $DAEMON --oknodo --signal 10
		echo "$NAME."
		;;

	force-stop)
		echo -n "Stopping $DESC: "
		start-stop-daemon -K -q -p $PIDFILE -x $DAEMON
		echo "$NAME."
		;;

	force-reload)
		if start-stop-daemon -K -q -p $PIDFILE -x $DAEMON --test
		then
			$0 restart
		fi
		;;

	restart)
		$0 stop
		sleep 1
		$0 start
		;;

	*)
		N=/etc/init.d/$NAME
		echo "Usage: $N {start|stop|force-stop|restart|force-reload}" >&2
		exit 1
		;;
esac

exit 0