]>
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 | |
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. |
a4aad8e2 | 23 | if is_no "${NETWORKING}"; then |
24 | # nls "ERROR: Networking is down. %s can't be run." <service> | |
c1db4afe | 25 | msg_network_down httpd |
a4aad8e2 | 26 | exit 1 |
036261c0 | 27 | fi |
1f86fa83 | 28 | |
8409de7b | 29 | if is_no "${IPV6_NETWORKING}"; then |
1f86fa83 | 30 | HTTPD_OPTS="$HTTPD_OPTS -4" |
31 | fi | |
58f9559b AF |
32 | |
33 | # See how we were called. | |
34 | case "$1" in | |
35 | start) | |
34c86420 | 36 | # Check if the service is already running? |
a4aad8e2 | 37 | if [ ! -f /var/lock/subsys/httpd ]; then |
38 | msg_starting httpd | |
1f86fa83 | 39 | daemon httpd $HTTPD_OPTS |
a4aad8e2 | 40 | RETVAL=$? |
41 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/httpd | |
34c86420 | 42 | else |
c1db4afe | 43 | msg_already_running httpd |
a4aad8e2 | 44 | exit 1 |
34c86420 | 45 | fi |
58f9559b AF |
46 | ;; |
47 | stop) | |
a4aad8e2 | 48 | # Stop daemons. |
49 | if [ -f /var/lock/subsys/httpd ]; then | |
50 | msg_stopping httpd | |
51 | killproc httpd | |
52 | rm -f /var/lock/subsys/httpd /var/run/httpd.pid /var/run/httpd.loc* >/dev/null 2>&1 | |
53 | else | |
c1db4afe | 54 | msg_not_running httpd |
a4aad8e2 | 55 | exit 1 |
56 | fi | |
58f9559b AF |
57 | ;; |
58 | status) | |
59 | status httpd | |
3226fe05 | 60 | /usr/sbin/httpd -S |
a4aad8e2 | 61 | exit $? |
58f9559b | 62 | ;; |
34c86420 | 63 | restart|reload) |
58f9559b AF |
64 | $0 stop |
65 | $0 start | |
66 | ;; | |
a4790892 AM |
67 | graceful) |
68 | if [ -f /var/lock/subsys/httpd ]; then | |
69 | msg_reloading httpd | |
70 | killproc httpd -USR1 | |
71 | RETVAL=$? | |
72 | else | |
73 | msg_not_running httpd >&2 | |
74 | RETVAL=7 | |
75 | fi | |
76 | ;; | |
58f9559b | 77 | *) |
a4790892 | 78 | msg_usage "$0 {start|stop|restart|graceful|status}" |
58f9559b AF |
79 | exit 1 |
80 | ;; | |
81 | esac | |
82 | ||
a4aad8e2 | 83 | exit $RETVAL |