3 # cherokee Start the cherokee HTTP server.
7 # description: Cherokee is Fast, Flexible and Lightweight Web server
10 # Source function library
11 . /etc/rc.d/init.d/functions
14 . /etc/sysconfig/network
16 # Get service config - may override defaults
17 [ -f /etc/sysconfig/cherokee ] && . /etc/sysconfig/cherokee
19 # Check that networking is up.
20 if is_yes "${NETWORKING}"; then
21 if [ ! -f /var/lock/subsys/network ]; then
22 msg_network_down "Cherokee Web Server"
30 # must return non-zero if check failed
31 # output is discarded if checkconfig is ran without details
33 local test_result="$(/usr/sbin/cherokee -t 2>&1)"
34 # exit status is not usable here, parse the output
35 if [ "${test_result##Test on*: }" = "OK" ] ; then
43 # wrapper for configtest
44 # with $details = 1 will report ok/fail status to output (status action)
45 # with $details = 0 will silently discard ok output, and with fail exit script with failure
49 if [ $details = 1 ]; then
50 # run config test and display report (status action)
51 show "Checking %s configuration" "Cherokee Web Server"; busy
53 out=$(configtest 2>&1)
55 if [ $RETVAL = 0 ]; then
60 [ "$out" ] && echo >&2 "$out"
62 # run config test and abort with nice message if failed
63 # (for actions checking status before action).
64 configtest >/dev/null 2>&1
66 if [ $RETVAL != 0 ]; then
67 show "Checking %s configuration" "Cherokee Web Server"; fail
68 nls 'Configuration test failed. See details with %s "checkconfig"' $0
75 # Check if the service is already running?
76 if [ -f /var/lock/subsys/cherokee ]; then
77 msg_already_running "Cherokee Web Server"
81 msg_starting "Cherokee Web Server"
84 if [ $RETVAL -eq 0 ]; then
85 touch /var/lock/subsys/cherokee
90 if [ ! -f /var/lock/subsys/cherokee ]; then
91 msg_not_running "Cherokee Web Server"
96 msg_stopping "Cherokee Web Server"
99 rm -f /var/lock/subsys/cherokee >/dev/null 2>&1
103 if [ ! -f /var/lock/subsys/cherokee ]; then
104 msg_not_running "Cherokee Web Server"
115 if [ ! -f /var/lock/subsys/cherokee ]; then
116 msg_not_running "Cherokee Web Server"
121 msg_reloading "Cherokee Web Server"
122 pid="$(pidofproc cherokee)"
123 if [ -n "$pid" ] && kill -HUP $(pidofproc cherokee); then
125 elif [ "$1" = "force-reload" ] ; then
137 # See how we were called.
156 checkconfig|configtest)
165 msg_usage "$0 {start|stop|restart|try-restart|force-reload|configtest|status}"