3 # apache Apache Web Server
6 # description: Apache is a World Wide Web server. It is used to serve \
9 # pidfile: /var/run/apache.pid
10 # config: /etc/apache/apache.conf
13 # Source function library
14 . /etc/rc.d/init.d/functions
17 . /etc/sysconfig/network
20 [ -f /etc/sysconfig/apache ] && . /etc/sysconfig/apache
22 # Check that networking is up.
23 if is_yes "${NETWORKING}"; then
24 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
25 msg_network_down apache
32 if is_no "${IPV6_NETWORKING}"; then
33 HTTPD_OPTS="$HTTPD_OPTS -4"
37 # See how we were called.
40 # Check if the service is already running?
41 if [ -x /usr/lib/apache1/lingerd ]; then
42 if [ ! -f /var/lock/subsys/lingerd ]; then
44 SERVICE_UMASK=002 daemon --user http /usr/lib/apache1/lingerd
46 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lingerd
48 msg_already_running lingerd
51 if [ ! -f /var/lock/subsys/apache ]; then
53 daemon apache $HTTPD_OPTS
55 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/apache
57 msg_already_running apache
62 if [ -f /var/lock/subsys/apache ]; then
65 rm -f /var/lock/subsys/apache /var/run/apache.pid /var/run/apache.loc* >/dev/null 2>&1
67 msg_not_running apache
69 if [ -x /usr/lib/apache1/lingerd ]; then
70 if [ -f /var/lock/subsys/lingerd ]; then
72 /usr/lib/apache1/lingerd -k && ok || fail
73 rm -f /var/lock/subsys/lingerd >/dev/null 2>&1
75 msg_not_running lingerd
85 apache -t > /dev/null 2>&1
87 if [ $RETVAL -eq 0 ]; then
89 RETVAL=$((RETVAL + $?))
91 RETVAL=$((RETVAL + $?))
94 echo "Configuration file syntax test failed."
99 if [ -f /var/lock/subsys/apache ]; then
102 apache -t > /dev/null 2>&1
104 if [ $RETVAL -eq 0 ]; then
108 echo "Configuration file syntax test failed."
111 msg_not_running apache >&2
116 if [ -f /var/lock/subsys/apache ]; then
119 apache -t > /dev/null 2>&1
121 if [ $RETVAL -eq 0 ]; then
122 killproc apache -USR1
125 echo >&2 "Configuration file syntax test failed."
128 msg_not_running apache >&2
133 if [ -f /var/lock/subsys/apache ]; then
136 apache -t > /dev/null 2>&1
138 if [ $RETVAL -eq 0 ]; then
139 killproc apache -USR1
143 echo >&2 "Configuration file syntax test failed."
151 msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|configtest|status}"