]> git.gir.st - ttxd.git/blob - src/thttpd-2.27/contrib/redhat-rpm/thttpd.init
initial code import
[ttxd.git] / src / thttpd-2.27 / contrib / redhat-rpm / thttpd.init
1 #!/bin/bash
2 # The following two lines enable chkconfig(1) to manipulate this script
3 # chkconfig: 2345 99 01
4 # description: control Jef Poskanzer's tiny/turbo/throttling http daemon
5
6 # source function library
7 . /etc/rc.d/init.d/functions
8
9 pidfile=/var/run/thttpd.pid
10 pid=`cat $pidfile 2>/dev/null`
11
12 if test -n "$pid" && kill -0 $pid 2>/dev/null; then
13 dead=no
14 else
15 dead=yes
16 fi
17
18 die(){
19 echo -n "$*"; echo_failure; echo ''
20 exit 1;
21 }
22
23 case "$1" in
24 start) test "$dead" = yes || die thttpd is already running
25 echo -n "Starting thttpd: "
26 daemon /usr/sbin/thttpd -C /etc/thttpd.conf
27 touch /var/lock/subsys/thttpd
28 echo_success;echo ''
29 exit 0
30 ;;
31 stop) echo -n "Gently shutting down thttpd: "
32 signal=USR1
33 ;;
34 kill) echo -n "Violently killing thttpd: "
35 signal=INT
36 ;;
37 status) status thttpd; exit $?;;
38 restart) $0 stop; sleep 2; exec $0 start;;
39 *) die "Usage: thttpd {start|stop|restart|status}";;
40 esac
41
42 test "$dead" = no || die thttpd is not running
43 kill -$signal $pid
44 sleep 2
45 kill -0 $pid 2>/dev/null && die "thttpd[$pid] will not die"
46 rm -f /var/lock/subsys/thttpd
47 echo_success; echo ''
Imprint / Impressum