Skip to content

Instantly share code, notes, and snippets.

@bulain
Created September 26, 2011 14:07
Show Gist options
  • Save bulain/1242311 to your computer and use it in GitHub Desktop.
Save bulain/1242311 to your computer and use it in GitHub Desktop.
ubuntu lighttpd /etc/init.d/lighttpd
#! /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
@codergs
Copy link

codergs commented Jul 27, 2016

This script fails to create pid file when process starts. Even on calling stop using this, the ps still shows the lighttpd process running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment