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 msg_starting "Cherokee Web Server"
85 if [ $RETVAL -eq 0 ]; then
86 touch /var/lock/subsys/cherokee
91 if [ ! -f /var/lock/subsys/cherokee ]; then
92 msg_not_running "Cherokee Web Server"
97 msg_stopping "Cherokee Web Server"
100 rm -f /var/lock/subsys/cherokee >/dev/null 2>&1
104 if [ ! -f /var/lock/subsys/cherokee ]; then
105 msg_not_running "Cherokee Web Server"
116 if [ ! -f /var/lock/subsys/cherokee ]; then
117 msg_not_running "Cherokee Web Server"
122 msg_reloading "Cherokee Web Server"
123 pid="$(pidofproc cherokee)"
124 if [ -n "$pid" ] && kill -HUP $(pidofproc cherokee); then
126 elif [ "$1" = "force-reload" ] ; then
138 # See how we were called.
157 checkconfig|configtest)
166 msg_usage "$0 {start|stop|restart|try-restart|force-reload|configtest|status}"