]>
Commit | Line | Data |
---|---|---|
8faab90e | 1 | #!/bin/sh |
58f9559b | 2 | # |
6a8e5f8a | 3 | # httpd Apache Web Server |
58f9559b | 4 | # |
34c86420 | 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 | |
d13b5a8c | 10 | # config: /etc/httpd/httpd.conf |
34c86420 | 11 | |
12 | ||
13 | # Source function library | |
58f9559b AF |
14 | . /etc/rc.d/init.d/functions |
15 | ||
34c86420 | 16 | # Get network config |
17 | . /etc/sysconfig/network | |
18 | ||
19 | # Get service config | |
20 | [ -f /etc/sysconfig/apache ] && . /etc/sysconfig/apache | |
21 | ||
58f9559b | 22 | # Check that networking is up. |
6a8e5f8a AM |
23 | if is_yes "${NETWORKING}"; then |
24 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; 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 | |
036261c0 | 31 | fi |
1f86fa83 | 32 | |
8409de7b | 33 | if is_no "${IPV6_NETWORKING}"; then |
6a8e5f8a | 34 | HTTPD_OPTS="$HTTPD_OPTS -4" |
1f86fa83 | 35 | fi |
58f9559b | 36 | |
6a8e5f8a | 37 | RETVAL=0 |
58f9559b AF |
38 | # See how we were called. |
39 | case "$1" in | |
40 | start) | |
34c86420 | 41 | # Check if the service is already running? |
6a8e5f8a | 42 | if [ ! -f /var/lock/subsys/httpd ]; then |
a4aad8e2 | 43 | msg_starting httpd |
1f86fa83 | 44 | daemon httpd $HTTPD_OPTS |
6a8e5f8a | 45 | RETVAL=$? |
a4aad8e2 | 46 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/httpd |
34c86420 | 47 | else |
6a8e5f8a | 48 | msg_already_running httpd |
34c86420 | 49 | fi |
58f9559b AF |
50 | ;; |
51 | stop) | |
6a8e5f8a | 52 | # Stop daemons. |
a4aad8e2 | 53 | if [ -f /var/lock/subsys/httpd ]; then |
6a8e5f8a AM |
54 | msg_stopping httpd |
55 | killproc httpd | |
7bf8705c | 56 | rm -f /var/lock/subsys/httpd /var/run/httpd.pid /var/run/httpd.loc* >/dev/null 2>&1 |
6a8e5f8a | 57 | else |
c1db4afe | 58 | msg_not_running httpd |
a4aad8e2 | 59 | fi |
58f9559b AF |
60 | ;; |
61 | status) | |
62 | status httpd | |
6a8e5f8a | 63 | RETVAL=$? |
3226fe05 | 64 | /usr/sbin/httpd -S |
58f9559b | 65 | ;; |
6a8e5f8a | 66 | restart) |
58f9559b AF |
67 | $0 stop |
68 | $0 start | |
6a8e5f8a AM |
69 | exit $? |
70 | ;; | |
71 | reload|force-reload) | |
72 | if [ -f /var/lock/subsys/httpd ]; then | |
73 | msg_reloading httpd | |
74 | killproc httpd -HUP | |
75 | RETVAL=$? | |
76 | else | |
77 | msg_not_running httpd >&2 | |
78 | RETVAL=7 | |
79 | fi | |
58f9559b | 80 | ;; |
a4790892 AM |
81 | graceful) |
82 | if [ -f /var/lock/subsys/httpd ]; then | |
6a8e5f8a | 83 | msg_reloading httpd |
a4790892 AM |
84 | killproc httpd -USR1 |
85 | RETVAL=$? | |
6a8e5f8a AM |
86 | else |
87 | msg_not_running httpd >&2 | |
a4790892 AM |
88 | RETVAL=7 |
89 | fi | |
90 | ;; | |
58f9559b | 91 | *) |
6a8e5f8a AM |
92 | msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|status}" |
93 | exit 3 | |
58f9559b AF |
94 | ;; |
95 | esac | |
96 | ||
a4aad8e2 | 97 | exit $RETVAL |