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 out=$(env SHELL=/bin/sh lighttpd -t -f /etc/lighttpd/lighttpd.conf $HTTPD_OPTS 2>&1)
32 if [ "$rc" = 0 ]; then
41 env SHELL=/bin/sh lighttpd -f /etc/lighttpd/lighttpd.conf $HTTPD_OPTS
43 if [ $RETVAL -eq 0 ]; then
45 touch /var/lock/subsys/lighttpd
53 killproc --pidfile /var/run/lighttpd.pid lighttpd
54 rm -f /var/lock/subsys/lighttpd >/dev/null 2>&1
58 # sending INT signal will make lighttpd close all listening sockets and
59 # wait for client connections to terminate.
60 killproc --pidfile /var/run/lighttpd.pid lighttpd -INT
61 env SHELL=/bin/sh lighttpd -f /etc/lighttpd/lighttpd.conf $HTTPD_OPTS
65 # See how we were called.
68 # Check if the service is already running?
69 if [ ! -f /var/lock/subsys/lighttpd ]; then
70 msg_starting "Lighttpd Web Server"
74 msg_already_running "Lighttpd Web Server"
79 if [ -f /var/lock/subsys/lighttpd ]; then
80 msg_stopping "Lighttpd Web Server"
83 msg_not_running "Lighttpd Web Server"
91 if [ -f /var/lock/subsys/lighttpd ]; then
94 # short circuit to safe reload if pid exists and is alive
95 pid=$(pidofproc lighttpd lighttpd.pid)
96 if [ "$pid" ] && checkpid $pid; then
97 msg_reloading "Lighttpd Web Server"
100 msg_stopping "Lighttpd Web Server"
102 msg_starting "Lighttpd Web Server"
107 msg_not_running "Lighttpd Web Server"
108 msg_starting "Lighttpd Web Server"
112 reload|graceful|force-reload)
113 if [ -f /var/lock/subsys/lighttpd ]; then
114 msg_reloading "Lighttpd Web Server"
119 msg_not_running "Lighttpd Web Server"
124 show "Checking lighttpd config syntax"
127 [ $RETVAL = 0 ] && ok || fail
130 if [ -f /var/lock/subsys/lighttpd ]; then
131 nls "Rotating %s logs" lighttpd
132 killproc --pidfile /var/run/lighttpd.pid lighttpd -HUP
135 msg_not_running "Lighttpd Web Server"
140 msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|configtest|flush-logs|status}"