# Check if the service is already running?
if [ ! -f /var/lock/subsys/cherokee ]; then
msg_starting "Cherokee Web Server"
- start-stop-daemon --start --exec /usr/sbin/cherokee --background --pidfile /var/run/cherokee.pid
+ (
+ # it offers no stdout/stderr logging. workaround
+ exec 2>>/var/log/cherokee/cherokee.log
+ exec 1>&2
+ start-stop-daemon --start --exec /usr/sbin/cherokee --pidfile /var/run/cherokee.pid -- -b
+ )
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
+ # the pidfile written is wrong when cherokee -b is used. damn
+ pid=$(/sbin/pidof cherokee)
+ echo $pid > /var/run/cherokee.pid
touch /var/lock/subsys/cherokee
ok
else
msg_not_running "Cherokee Web Server"
fi
;;
- restart)
+ restart|force-reload)
$0 stop
$0 start
exit $?
;;
- reload)
- if [ -f /var/lock/subsys/cherokee ]; then
- msg_reloading "Cherokee Web Server"
- start-stop-daemon --stop --pidfile /var/run/cherokee.pid --signal HUP
- RETVAL=$?
- else
- msg_not_running "Cherokee Web Server" >&2
- RETVAL=7
- fi
- ;;
- force-reload)
- $0 reload
- exit $?
- ;;
status)
status cherokee
RETVAL=$?
;;
*)
- msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
+ msg_usage "$0 {start|stop|restart|status}"
exit 3
esac