desktop/cherokee/cherokee.rc

67 lines
1.3 KiB
Plaintext
Raw Normal View History

#!/bin/bash
daemon_name=cherokee
. /etc/rc.conf
. /etc/rc.d/functions
case "$1" in
start)
stat_busy "Starting $daemon_name daemon"
2012-01-20 09:03:11 +08:00
if [ ! -f /var/run/$daemon_name.pid ] && "${daemon_name}" -d &>/dev/null; then
add_daemon "${daemon_name}"
stat_done
else
stat_fail
exit 1
fi
;;
stop)
stat_busy "Stopping $daemon_name daemon"
2012-01-20 09:03:11 +08:00
[ -f "/var/run/${daemon_name}.pid" ] && read PID < "/var/run/${daemon_name}.pid"
if kill "${PID}" &>/dev/null; then
rm_daemon "${daemon_name}"
stat_done
else
stat_fail
exit 1
fi
;;
reload)
2012-01-20 09:03:11 +08:00
stat_busy "Reloading ${daemon_name} daemon"
[ -f "/var/run/${daemon_name}.pid" ] && read PID < "/var/run/${daemon_name}.pid"
if kill -HUP "${PID}" &>/dev/null; then
add_daemon "${daemon_name}"
stat_done
else
stat_fail
exit 1
fi
;;
restart)
2012-01-20 09:03:11 +08:00
stat_busy "Restarting ${daemon_name} daemon"
[ -f "/var/run/${daemon_name}.pid" ] && read PID < "/var/run/${daemon_name}.pid"
if kill -USR1 "${PID}" &>/dev/null; then
add_daemon "${daemon_name}"
stat_done
else
stat_fail
exit 1
fi
;;
status)
stat_busy "Checking $daemon_name status";
2012-01-20 09:03:11 +08:00
ck_status "${daemon_name}"
;;
*)
2012-01-20 09:03:11 +08:00
echo "usage: ${0} {start|stop|reload|restart|status}"
esac
exit 0
2011-12-22 09:02:48 +08:00