Created
September 26, 2011 14:07
-
-
Save bulain/1242311 to your computer and use it in GitHub Desktop.
ubuntu lighttpd /etc/init.d/lighttpd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
set -e | |
LIGHTY=/usr/local/sbin/lighttpd | |
LIGHTYCONFIG=/etc/lighttpd/lighttpd.conf | |
test -x $LIGHTY || exit 10 | |
test -e $LIGHTYCONFIG || exit 11 | |
. /lib/lsb/init-functions | |
case "$1" in | |
start) | |
log_begin_msg "Starting lighttpd..." | |
start-stop-daemon --start --quiet --pidfile /var/run/lighttpd.pid --exec $LIGHTY -- -f $LIGHTYCONFIG || log_end_msg 1 | |
log_end_msg 0 | |
;; | |
stop) | |
log_begin_msg "Stopping lighttpd..." | |
start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/lighttpd.pid || log_end_msg 1 | |
log_end_msg 0 | |
;; | |
reload|force-reload) | |
log_begin_msg "Reloading lighttpd..." | |
start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile /var/run/lighttpd.pid --exec $LIGHTY -- -f $LIGHTYCONFIG || log_end_msg 1 | |
log_end_msg 0 | |
;; | |
restart) | |
log_begin_msg "Restarting lighttpd..." | |
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/lighttpd.pid | |
start-stop-daemon --start --quiet --pidfile /var/run/lighttpd.pid --exec $LIGHTY -- -f $LIGHTYCONFIG || log_end_msg 1 | |
log_end_msg 0 | |
;; | |
*) | |
log_success_msg "Usage: /etc/init.d/lighttpd {start|stop|reload|force-reload|restart}" | |
exit 1 | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script fails to create pid file when process starts. Even on calling stop using this, the ps still shows the lighttpd process running.