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