]> git.pld-linux.org Git - packages/cherokee.git/blob - cherokee.init
- started upgrade to 0.99.29
[packages/cherokee.git] / cherokee.init
1 #!/bin/sh
2 #
3 # cherokee      Start the cherokee HTTP server.
4 #
5 # chkconfig:    345 20 80
6 #
7 # description:  Cherokee is Fast, Flexible and Lightweight Web server
8 #
9 # $Id$
10
11 # Source function library
12 . /etc/rc.d/init.d/functions
13
14 # Get network config
15 . /etc/sysconfig/network
16
17 # Get service config - may override defaults
18 [ -f /etc/sysconfig/cherokee ] && . /etc/sysconfig/cherokee
19
20 # Check that networking is up.
21 if is_yes "${NETWORKING}"; then
22         if [ ! -f /var/lock/subsys/network ]; then
23                 msg_network_down "Cherokee Web Server"
24                 exit 1
25         fi
26 else
27         exit 0
28 fi
29
30 start() {
31         # Check if the service is already running?
32         if [ ! -f /var/lock/subsys/cherokee ]; then
33                 msg_starting "Cherokee Web Server"
34                 (
35                 # it offers no stdout/stderr logging. workaround
36                 exec 2>>/var/log/cherokee/cherokee.log
37                 exec 1>&2
38                 start-stop-daemon --start --pidfile /var/run/cherokee.pid --oknodo -b --exec /usr/sbin/cherokee
39                 )
40                 RETVAL=$?
41                 if [ $RETVAL -eq 0 ]; then
42                         touch /var/lock/subsys/cherokee
43                         ok
44                 else
45                         fail
46                 fi
47         else
48                 msg_already_running "Cherokee Web Server"
49         fi
50 }
51
52 stop() {
53         if [ -f /var/lock/subsys/cherokee ]; then
54                 # Stop daemons.
55                 msg_stopping "Cherokee Web Server"
56                 start-stop-daemon --stop --pidfile /var/run/cherokee.pid --oknodo --exec /usr/sbin/cherokee
57                 RETVAL=$?
58                 if [ $RETVAL -eq 0 ]; then
59                         rm -f /var/lock/subsys/cherokee >/dev/null 2>&1
60                         ok
61                 else
62                         fail
63                 fi
64         else
65                 msg_not_running "Cherokee Web Server"
66         fi
67 }
68
69 condrestart() {
70         if [ -f /var/lock/subsys/cherokee ]; then
71                 stop
72                 start
73         else
74                 msg_not_running "Cherokee Web Server"
75                 RETVAL=$1
76         fi
77 }
78
79 RETVAL=0
80 # See how we were called.
81 case "$1" in
82   start)
83         start
84         ;;
85   stop)
86         stop
87         ;;
88   restart)
89         stop
90         start
91         ;;
92   try-restart)
93         condrestart 0
94         ;;
95   force-reload)
96         condrestart 7
97         ;;
98   status)
99         status cherokee
100         RETVAL=$?
101         ;;
102   *)
103         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
104         exit 3
105 esac
106
107 exit $RETVAL
This page took 0.045856 seconds and 3 git commands to generate.