#!/bin/sh # # cherokee Start the cherokee HTTP server. # # chkconfig: 345 20 80 # # description: Cherokee is Fast, Flexible and Lightweight Web server # # $Id$ # Source function library . /etc/rc.d/init.d/functions # Get network config . /etc/sysconfig/network # Get service config - may override defaults [ -f /etc/sysconfig/cherokee ] && . /etc/sysconfig/cherokee # Check that networking is up. if is_yes "${NETWORKING}"; then if [ ! -f /var/lock/subsys/network ]; then msg_network_down "Cherokee Web Server" exit 1 fi else exit 0 fi start() { # Check if the service is already running? if [ ! -f /var/lock/subsys/cherokee ]; then msg_starting "Cherokee Web Server" ( # it offers no stdout/stderr logging. workaround exec 2>>/var/log/cherokee/cherokee.log exec 1>&2 start-stop-daemon --start --pidfile /var/run/cherokee.pid --oknodo -b --exec /usr/sbin/cherokee ) RETVAL=$? if [ $RETVAL -eq 0 ]; then touch /var/lock/subsys/cherokee ok else fail fi else msg_already_running "Cherokee Web Server" fi } stop() { if [ -f /var/lock/subsys/cherokee ]; then # Stop daemons. msg_stopping "Cherokee Web Server" start-stop-daemon --stop --pidfile /var/run/cherokee.pid --oknodo --exec /usr/sbin/cherokee RETVAL=$? if [ $RETVAL -eq 0 ]; then rm -f /var/lock/subsys/cherokee >/dev/null 2>&1 ok else fail fi else msg_not_running "Cherokee Web Server" fi } condrestart() { if [ -f /var/lock/subsys/cherokee ]; then stop start else msg_not_running "Cherokee Web Server" RETVAL=$1 fi } RETVAL=0 # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) stop start ;; try-restart) condrestart 0 ;; force-reload) condrestart 7 ;; status) status cherokee RETVAL=$? ;; *) msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}" exit 3 esac exit $RETVAL