]>
Commit | Line | Data |
---|---|---|
0f05f0de JB |
1 | #!/bin/sh |
2 | # | |
3 | # apache Apache Web Server | |
4 | # | |
5 | # chkconfig: 345 85 15 | |
6 | # description: Apache is a World Wide Web server. It is used to serve \ | |
7 | # HTML files and CGI. | |
8 | # processname: httpd | |
9 | # pidfile: /var/run/httpd.pid | |
10 | # config: /etc/httpd/httpd.conf | |
11 | ||
12 | ||
13 | # Source function library | |
14 | . /etc/rc.d/init.d/functions | |
15 | ||
16 | # Get network config | |
17 | . /etc/sysconfig/network | |
18 | ||
19 | # Get service config | |
20 | [ -f /etc/sysconfig/apache ] && . /etc/sysconfig/apache | |
21 | ||
22 | # Check that networking is up. | |
2b61eec8 | 23 | if is_yes "${NETWORKING}"; then |
24 | if [ ! -f /var/lock/subsys/network ]; then | |
25 | # nls "ERROR: Networking is down. %s can't be run." <service> | |
26 | msg_network_down httpd | |
27 | exit 1 | |
28 | fi | |
29 | else | |
30 | exit 0 | |
0f05f0de JB |
31 | fi |
32 | ||
33 | if is_no "${IPV6_NETWORKING}"; then | |
2b61eec8 | 34 | HTTPD_OPTS="$HTTPD_OPTS -4" |
0f05f0de JB |
35 | fi |
36 | ||
37 | # See how we were called. | |
38 | case "$1" in | |
39 | start) | |
40 | # Check if the service is already running? | |
2b61eec8 | 41 | if [ ! -f /var/lock/subsys/httpd ]; then |
0f05f0de JB |
42 | msg_starting httpd |
43 | daemon httpd $HTTPD_OPTS | |
2b61eec8 | 44 | RETVAL=$? |
0f05f0de JB |
45 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/httpd |
46 | else | |
2b61eec8 | 47 | msg_already_running httpd |
48 | exit 1 | |
0f05f0de JB |
49 | fi |
50 | ;; | |
51 | stop) | |
2b61eec8 | 52 | # Stop daemons. |
0f05f0de | 53 | if [ -f /var/lock/subsys/httpd ]; then |
2b61eec8 | 54 | msg_stopping httpd |
55 | killproc httpd | |
56 | rm -f /var/lock/subsys/httpd /var/run/httpd.pid /var/run/httpd.loc* >/dev/null 2>&1 | |
57 | else | |
0f05f0de | 58 | msg_not_running httpd |
2b61eec8 | 59 | exit 1 |
0f05f0de JB |
60 | fi |
61 | ;; | |
62 | status) | |
63 | status httpd | |
64 | /usr/sbin/httpd -S | |
65 | exit $? | |
66 | ;; | |
67 | restart|reload) | |
68 | $0 stop | |
69 | $0 start | |
70 | ;; | |
71 | *) | |
626711b4 | 72 | msg_usage "$0 {start|stop|restart|reload|status}" |
0f05f0de JB |
73 | exit 1 |
74 | ;; | |
75 | esac | |
76 | ||
77 | exit $RETVAL |