contrib/lighttpd/lighttpd.rc

37 lines
775 B
Bash
Executable File

#!/bin/sh
#@ /etc/rc.d/lighttpd: start/stop lighttpd daemon
SSD=/sbin/start-stop-daemon
PROG=/usr/sbin/lighttpd
PID=/run/lighttpd.pid
OPTS='-f /etc/lighttpd.conf'
case ${1} in
start)
exec ${SSD} --start --pidfile ${PID} --exec ${PROG} -- ${OPTS}
;;
stop)
exec ${SSD} --stop --remove-pidfile --retry 10 --pidfile ${PID}
;;
restart)
${0} stop
exec ${0} start
;;
status)
${SSD} --status --pidfile ${PID}
e=${?}
case ${e} in
0) echo "${PROG} is running with pid $(cat ${PID})";;
1) echo "${PROG} is not running but the pid file ${PID} exists";;
3) echo "${PROG} is not running";;
4) echo "Unable to determine the program status";;
esac
exit ${e}
;;
*)
echo "usage: ${0} [start|stop|restart|status]"
;;
esac
# s-sh-mode