]> git.pld-linux.org Git - packages/cherokee.git/blob - cherokee.init
- 0.6.1
[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 # See how we were called.
31 case "$1" in
32   start)
33         # Check if the service is already running?
34         if [ ! -f /var/lock/subsys/cherokee ]; then
35                 msg_starting "Cherokee Web Server"
36                 (
37                 # it offers no stdout/stderr logging. workaround
38                 exec 2>>/var/log/cherokee/cherokee.log
39                 exec 1>&2
40                 start-stop-daemon --start --exec /usr/sbin/cherokee-guardian -- -b
41                 )
42                 RETVAL=$?
43                 if [ $RETVAL -eq 0 ]; then
44                         touch /var/lock/subsys/cherokee
45                         ok
46                 else
47                         fail
48                 fi
49         else
50                 msg_already_running "Cherokee Web Server"
51         fi
52         ;;
53   stop)
54         if [ -f /var/lock/subsys/cherokee ]; then
55                 # Stop daemons.
56                 msg_stopping "Cherokee Web Server"
57                 start-stop-daemon --stop --pidfile /var/run/cherokee-guardian.pid --oknodo --exec /usr/sbin/cherokee-guardian
58                 RETVAL=$?
59                 if [ $RETVAL -eq 0 ]; then
60                         rm -f /var/lock/subsys/cherokee >/dev/null 2>&1
61                         ok
62                 else
63                         fail
64                 fi
65         else
66                 msg_not_running "Cherokee Web Server"
67         fi
68         ;;
69   restart|force-reload)
70         $0 stop
71         $0 start
72         exit $?
73         ;;
74   status)
75         status cherokee
76         RETVAL=$?
77         ;;
78   *)
79         msg_usage "$0 {start|stop|restart|force-reload|status}"
80         exit 3
81 esac
82
83 exit $RETVAL
84
85 # This must be last line !
86 # vi:syntax=sh
This page took 0.070867 seconds and 3 git commands to generate.