]>
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 | |
22 | # nls "ERROR: Networking is down. %s can't be run." <service> | |
23 | msg_network_down lighttpd | |
24 | exit 1 | |
25 | fi | |
26 | else | |
27 | exit 0 | |
28 | fi | |
29 | ||
30 | RETVAL=0 | |
31 | # See how we were called. | |
32 | case "$1" in | |
33 | start) | |
34 | # Check if the service is already running? | |
35 | if [ ! -f /var/lock/subsys/lighttpd ]; then | |
36 | msg_starting lighttpd | |
37 | daemon lighttpd -f /etc/lighttpd/lighttpd.conf $HTTPD_OPTS | |
38 | RETVAL=$? | |
39 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lighttpd | |
40 | else | |
41 | msg_already_running lighttpd | |
42 | fi | |
43 | ;; | |
44 | stop) | |
45 | # Stop daemons. | |
46 | if [ -f /var/lock/subsys/lighttpd ]; then | |
47 | msg_stopping lighttpd | |
48 | killproc lighttpd | |
49 | rm -f /var/lock/subsys/lighttpd >/dev/null 2>&1 | |
50 | else | |
51 | msg_not_running lighttpd | |
52 | fi | |
53 | ;; | |
54 | status) | |
55 | status lighttpd | |
56 | RETVAL=$? | |
57 | ;; | |
58 | restart) | |
59 | $0 stop | |
60 | $0 start | |
61 | ;; | |
62 | reload|force-reload|graceful) | |
63 | if [ -f /var/lock/subsys/lighttpd ]; then | |
64 | msg_reloading lighttpd | |
65 | killproc lighttpd -HUP | |
66 | RETVAL=$? | |
67 | else | |
68 | msg_not_running lighttpd | |
69 | RETVAL=7 | |
70 | fi | |
71 | ;; | |
72 | *) | |
73 | msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|status}" | |
74 | exit 3 | |
75 | ;; | |
76 | esac | |
77 | ||
78 | exit $RETVAL |