3 # cherokee Start the cherokee HTTP server.
7 # description: Cherokee is Fast, Flexible and Lightweight Web server
11 # Source function library
12 . /etc/rc.d/init.d/functions
15 . /etc/sysconfig/network
17 # Get service config - may override defaults
18 [ -f /etc/sysconfig/cherokee ] && . /etc/sysconfig/cherokee
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"
31 # must return non-zero if check failed
32 # output is discarded if checkconfig is ran without details
34 local test_result="$(/usr/sbin/cherokee -t 2>&1)"
35 # exit status is not usable here, parse the output
36 if [ "${test_result##Test on*: }" = "OK" ] ; then
44 # wrapper for configtest
45 # with $details = 1 will report ok/fail status to output (status action)
46 # with $detauls = 0 will silently discard ok output, and with fail exit script with failure
50 if [ $details = 1 ]; then
51 # run config test and display report (status action)
52 show "Checking %s configuration" "Cherokee Web Server"; busy
54 out=$(configtest 2>&1)
56 if [ $RETVAL = 0 ]; then
61 [ "$out" ] && echo >&2 "$out"
63 # run config test and abort with nice message if failed
64 # (for actions checking status before action).
65 configtest >/dev/null 2>&1
67 if [ $RETVAL != 0 ]; then
68 show "Checking %s configuration" "Cherokee Web Server"; fail
69 nls 'Configuration test failed. See details with %s "checkconfig"' $0
76 # Check if the service is already running?
77 if [ -f /var/lock/subsys/cherokee ]; then
78 msg_already_running "Cherokee Web Server"
82 emit starting JOB=cherokee SERVICE=web-server
83 msg_starting "Cherokee Web Server"
86 if [ $RETVAL -eq 0 ]; then
87 touch /var/lock/subsys/cherokee
88 emit --no-wait started JOB=cherokee SERVICE=web-server
93 if [ ! -f /var/lock/subsys/cherokee ]; then
94 msg_not_running "Cherokee Web Server"
99 emit stopping JOB=cherokee SERVICE=web-server
100 msg_stopping "Cherokee Web Server"
103 rm -f /var/lock/subsys/cherokee >/dev/null 2>&1
104 emit --no-wait stopped JOB=cherokee SERVICE=web-server
108 if [ ! -f /var/lock/subsys/cherokee ]; then
109 msg_not_running "Cherokee Web Server"
120 if [ ! -f /var/lock/subsys/cherokee ]; then
121 msg_not_running "Cherokee Web Server"
126 msg_reloading "Cherokee Web Server"
127 pid="$(pidofproc cherokee)"
128 if [ -n "$pid" ] && kill -HUP $(pidofproc cherokee); then
130 elif [ "$1" = "force-reload" ] ; then
141 upstart_controlled --except configtest
144 # See how we were called.
163 checkconfig|configtest)
172 msg_usage "$0 {start|stop|restart|try-restart|force-reload|configtest|status}"