3 # lighttpd lighttpd Web Server
6 # description: lighttpd is a World Wide Web server. It is used to serve \
10 # Source function library
11 . /etc/rc.d/init.d/functions
14 . /etc/sysconfig/network
17 [ -f /etc/sysconfig/lighttpd ] && . /etc/sysconfig/lighttpd
19 # Check that networking is up.
20 if is_yes "${NETWORKING}"; then
21 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
22 msg_network_down "Lighttpd Web Server"
30 env SHELL=/bin/sh lighttpd -t -f /etc/lighttpd/lighttpd.conf $HTTPD_OPTS
33 # wrapper for configtest
37 if [ $details = 1 ]; then
38 # run config test and display report (status action)
39 show "Checking %s configuration" "Lighttpd Web Server"; busy
43 if [ $RETVAL = 0 ]; then
48 [ "$out" ] && echo >&2 "$out"
50 # run config test and abort with nice message if failed
51 # (for actions checking status before action).
52 configtest >/dev/null 2>&1
54 if [ $RETVAL != 0 ]; then
55 show "Checking %s configuration" "Lighttpd Web Server"; fail
56 nls 'Configuration test failed. See details with %s "checkconfig"' $0
63 # Check if the service is already running?
64 if [ -f /var/lock/subsys/lighttpd ]; then
65 msg_already_running "Lighttpd Web Server"
70 msg_starting "Lighttpd Web Server"; busy
71 env SHELL=/bin/sh lighttpd -f /etc/lighttpd/lighttpd.conf $HTTPD_OPTS
73 if [ $RETVAL -eq 0 ]; then
75 touch /var/lock/subsys/lighttpd
83 if [ ! -f /var/lock/subsys/lighttpd ]; then
84 msg_not_running "Lighttpd Web Server"
88 msg_stopping "Lighttpd Web Server"
89 killproc --pidfile /var/run/lighttpd.pid lighttpd
90 rm -f /var/lock/subsys/lighttpd >/dev/null 2>&1
96 # short circuit to safe reload if pid exists and is alive
97 if [ -f /var/lock/subsys/lighttpd ] && pid=$(pidofproc lighttpd lighttpd.pid) && checkpid $pid; then
108 if [ ! -f /var/lock/subsys/lighttpd ]; then
109 msg_not_running "Lighttpd Web Server"
115 msg_reloading "Lighttpd Web Server"
117 # sending INT signal will make lighttpd close all listening sockets and
118 # wait for client connections to terminate.
119 killproc --pidfile /var/run/lighttpd.pid lighttpd -INT
120 env SHELL=/bin/sh lighttpd -f /etc/lighttpd/lighttpd.conf $HTTPD_OPTS
125 if [ ! -f /var/lock/subsys/lighttpd ]; then
126 msg_not_running "Lighttpd Web Server"
137 if [ ! -f /var/lock/subsys/lighttpd ]; then
138 msg_not_running "Lighttpd Web Server"
143 show "Rotating %s logs" lighttpd
144 killproc --pidfile /var/run/lighttpd.pid lighttpd -HUP
149 # See how we were called.
163 reload|force-reload|graceful)
169 checkconfig|configtest)
177 msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|configtest|flush-logs|status}"