]>
Commit | Line | Data |
---|---|---|
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/conf/access.conf | |
11 | # config: /etc/httpd/conf/httpd.conf | |
12 | # config: /etc/httpd/conf/srm.conf | |
13 | ||
14 | ||
15 | # Source function library | |
16 | . /etc/rc.d/init.d/functions | |
17 | ||
18 | # Get network config | |
19 | . /etc/sysconfig/network | |
20 | ||
21 | # Get service config | |
22 | [ -f /etc/sysconfig/apache ] && . /etc/sysconfig/apache | |
23 | ||
24 | # Check that networking is up. | |
25 | if is_yes "${NETWORKING}"; then | |
26 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then | |
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 | |
33 | fi | |
34 | ||
35 | RETVAL=0 | |
36 | # See how we were called. | |
37 | case "$1" in | |
38 | start) | |
39 | # Check if the service is already running? | |
40 | if [ ! -f /var/lock/subsys/httpd ]; then | |
41 | msg_starting httpd | |
42 | daemon httpd $HTTPD_OPTS | |
43 | RETVAL=$? | |
44 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/httpd | |
45 | else | |
46 | msg_already_running httpd | |
47 | fi | |
48 | ;; | |
49 | stop) | |
50 | # Stop daemons. | |
51 | if [ -f /var/lock/subsys/httpd ]; then | |
52 | msg_stopping httpd | |
53 | killproc httpd | |
54 | rm -f /var/lock/subsys/httpd /var/run/httpd.pid /var/run/httpd.loc* >/dev/null 2>&1 | |
55 | else | |
56 | msg_not_running httpd | |
57 | fi | |
58 | ;; | |
59 | status) | |
60 | status httpd | |
61 | RETVAL=$? | |
62 | /usr/sbin/httpd -S | |
63 | ;; | |
64 | restart) | |
65 | $0 stop | |
66 | $0 start | |
67 | exit $? | |
68 | ;; | |
69 | reload|force-reload) | |
70 | if [ -f /var/lock/subsys/httpd ]; then | |
71 | msg_reloading httpd | |
72 | killproc httpd -HUP | |
73 | RETVAL=$? | |
74 | else | |
75 | msg_not_running httpd >&2 | |
76 | RETVAL=7 | |
77 | fi | |
78 | ;; | |
79 | *) | |
80 | msg_usage "$0 {start|stop|restart|reload|force-reload|status}" | |
81 | exit 3 | |
82 | ;; | |
83 | esac | |
84 | ||
85 | exit $RETVAL |