File: thttpd.rc

package info (click to toggle)
thttpd 2.23beta1-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 684 kB
  • ctags: 679
  • sloc: ansic: 7,908; sh: 1,871; makefile: 310
file content (81 lines) | stat: -rw-r--r-- 1,901 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
#! /bin/sh

# /etc/init.d/thttpd - thttpd's init script.
# Written by Yotam Rubin <yotam@makif.omer.k12.il>

set -e

INIT=/etc/init.d/thttpd
CONFFILE=/etc/thttpd/thttpd.conf

if [ ! -f $CONFFILE ]; then
    exit 1
fi

NETSTAT=/bin/netstat
DAEMON=/usr/sbin/thttpd
NAME=thttpd
PIDFILE=/var/run/thttpd.pid

test -x $DAEMON || exit 0

case "$1" in
    start)
        echo -n "Starting web server: "
        if [ -f $PIDFILE ]; then
            PID=`cat $PIDFILE`
            if ps ax | grep -q "^$PID"; then
                echo "$DAEMON already running."
            else
                rm -f $PIDFILE
                $DAEMON -C $CONFFILE -i $PIDFILE
                echo "$NAME. "
            fi
        else
            $DAEMON -C $CONFFILE -i $PIDFILE
            echo "$NAME. "
        fi
        ;;
    stop)
        echo -n "Stopping web server: "
        if [ -f $PIDFILE ]; then
            PID=`cat $PIDFILE`
            if ps ax | grep -q "^$PID"; then
                kill -10 $PID
                echo "$NAME"
            else
                echo "No $DAEMON found running; none killed."
            fi
            rm -f $PIDFILE
        else
            echo "No $DAEMON found running; none killed."
        fi
        ;;
    force-stop)
        echo -n "Terminating web server: "
        if [ -f $PIDFILE ]; then
            PID=`cat $PIDFILE`
            if ps ax | grep -q "^$PID"; then
                kill -10 $PID
                echo "$NAME"
            else
                echo "No $DAEMON found running; none killed."
            fi
            rm -f $PIDFILE
        else
            echo "No $DAEMON found running; none killed."
        fi
        ;;
    restart|force-reload)
        $INIT stop 
        sleep 1 
        $INIT start
        ;;
    *)
        echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-stop|force-reload}"
        exit 1
        ;;
esac

exit 0