]>
Commit | Line | Data |
---|---|---|
cb1656fe AM |
1 | #!/bin/sh |
2 | # | |
3 | # lighttpd lighttpd Web Server | |
4 | # | |
5 | # chkconfig: 345 85 15 | |
6 | # description: lighttpd is a World Wide Web server. It is used to serve \ | |
7 | # HTML files and CGI. | |
8 | # | |
9 | ||
10 | # Source function library | |
11 | . /etc/rc.d/init.d/functions | |
12 | ||
13 | # Get network config | |
14 | . /etc/sysconfig/network | |
15 | ||
16 | # Get service config | |
17 | [ -f /etc/sysconfig/lighttpd ] && . /etc/sysconfig/lighttpd | |
18 | ||
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 | |
cb1656fe AM |
22 | msg_network_down lighttpd |
23 | exit 1 | |
24 | fi | |
25 | else | |
26 | exit 0 | |
27 | fi | |
28 | ||
29 | RETVAL=0 | |
30 | # See how we were called. | |
31 | case "$1" in | |
32 | start) | |
33 | # Check if the service is already running? | |
34 | if [ ! -f /var/lock/subsys/lighttpd ]; then | |
35 | msg_starting lighttpd | |
8e108f2d | 36 | daemon env SHELL=/bin/sh lighttpd -f /etc/lighttpd/lighttpd.conf $HTTPD_OPTS |
cb1656fe AM |
37 | RETVAL=$? |
38 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lighttpd | |
39 | else | |
40 | msg_already_running lighttpd | |
41 | fi | |
42 | ;; | |
43 | stop) | |
44 | # Stop daemons. | |
45 | if [ -f /var/lock/subsys/lighttpd ]; then | |
46 | msg_stopping lighttpd | |
647b6537 | 47 | killproc --pidfile /var/run/lighttpd.pid lighttpd |
cb1656fe AM |
48 | rm -f /var/lock/subsys/lighttpd >/dev/null 2>&1 |
49 | else | |
50 | msg_not_running lighttpd | |
51 | fi | |
52 | ;; | |
53 | status) | |
54 | status lighttpd | |
55 | RETVAL=$? | |
56 | ;; | |
57 | restart) | |
ca225ce7 ER |
58 | if [ -f /var/lock/subsys/lighttpd ]; then |
59 | msg_stopping lighttpd | |
60 | # sending INT signal will make lighttpd close all listening sockets and | |
61 | # wait for client connections to terminate. | |
647b6537 | 62 | killproc --pidfile /var/run/lighttpd.pid lighttpd -INT |
ca225ce7 ER |
63 | rm -f /var/lock/subsys/lighttpd >/dev/null 2>&1 |
64 | fi | |
cb1656fe AM |
65 | $0 start |
66 | ;; | |
67 | reload|force-reload|graceful) | |
68 | if [ -f /var/lock/subsys/lighttpd ]; then | |
69 | msg_reloading lighttpd | |
647b6537 | 70 | killproc --pidfile /var/run/lighttpd.pid lighttpd -HUP |
cb1656fe AM |
71 | RETVAL=$? |
72 | else | |
73 | msg_not_running lighttpd | |
74 | RETVAL=7 | |
75 | fi | |
76 | ;; | |
77 | *) | |
78 | msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|status}" | |
79 | exit 3 | |
80 | ;; | |
81 | esac | |
82 | ||
83 | exit $RETVAL |