]>
Commit | Line | Data |
---|---|---|
cf957d96 ER |
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 | |
1f50c961 | 23 | msg_network_down "Cherokee Web Server" |
cf957d96 ER |
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 | |
1f50c961 | 35 | msg_starting "Cherokee Web Server" |
bf571c7f ER |
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 --pidfile /var/run/cherokee.pid -- -b | |
41 | ) | |
cf957d96 | 42 | RETVAL=$? |
1f50c961 | 43 | if [ $RETVAL -eq 0 ]; then |
bf571c7f ER |
44 | # the pidfile written is wrong when cherokee -b is used. damn |
45 | pid=$(/sbin/pidof cherokee) | |
46 | echo $pid > /var/run/cherokee.pid | |
1f50c961 ER |
47 | touch /var/lock/subsys/cherokee |
48 | ok | |
49 | else | |
50 | fail | |
51 | fi | |
cf957d96 | 52 | else |
1f50c961 | 53 | msg_already_running "Cherokee Web Server" |
cf957d96 ER |
54 | fi |
55 | ;; | |
56 | stop) | |
57 | if [ -f /var/lock/subsys/cherokee ]; then | |
58 | # Stop daemons. | |
1f50c961 ER |
59 | msg_stopping "Cherokee Web Server" |
60 | start-stop-daemon --stop --pidfile /var/run/cherokee.pid --oknodo --exec /usr/sbin/cherokee | |
61 | RETVAL=$? | |
62 | if [ $RETVAL -eq 0 ]; then | |
63 | rm -f /var/run/cherokee.pid /var/lock/subsys/cherokee >/dev/null 2>&1 | |
64 | ok | |
65 | else | |
66 | fail | |
67 | fi | |
cf957d96 | 68 | else |
1f50c961 | 69 | msg_not_running "Cherokee Web Server" |
cf957d96 ER |
70 | fi |
71 | ;; | |
02cb0292 | 72 | restart|reload) |
cf957d96 ER |
73 | $0 stop |
74 | $0 start | |
75 | exit $? | |
76 | ;; | |
02cb0292 ER |
77 | # reload) |
78 | # if [ -f /var/lock/subsys/cherokee ]; then | |
79 | # msg_reloading "Cherokee Web Server" | |
80 | # start-stop-daemon --stop --pidfile /var/run/cherokee.pid --signal HUP && ok || fail | |
81 | # RETVAL=$? | |
82 | # else | |
83 | # msg_not_running "Cherokee Web Server" >&2 | |
84 | # RETVAL=7 | |
85 | # fi | |
86 | # ;; | |
cf957d96 ER |
87 | force-reload) |
88 | $0 reload | |
89 | exit $? | |
90 | ;; | |
91 | status) | |
92 | status cherokee | |
93 | RETVAL=$? | |
94 | ;; | |
95 | *) | |
96 | msg_usage "$0 {start|stop|restart|reload|force-reload|status}" | |
97 | exit 3 | |
98 | esac | |
99 | ||
100 | exit $RETVAL | |
101 | ||
102 | # This must be last line ! | |
103 | # vi:syntax=sh |