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 # nls "ERROR: Networking is down. %s can't be run." <service>
26 msg_network_down apache
33 if is_no "${IPV6_NETWORKING}"; then
34 HTTPD_OPTS="$HTTPD_OPTS -4"
38 # See how we were called.
41 # Check if the service is already running?
42 if [ -x /usr/lib/apache1/lingerd ]; then
43 if [ ! -f /var/lock/subsys/lingerd ]; then
45 SERVICE_UMASK=002 daemon --user http /usr/lib/apache1/lingerd
47 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lingerd
49 msg_already_running lingerd
52 if [ ! -f /var/lock/subsys/apache ]; then
54 daemon apache $HTTPD_OPTS
56 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/apache
58 msg_already_running apache
63 if [ -f /var/lock/subsys/apache ]; then
66 rm -f /var/lock/subsys/apache /var/run/apache.pid /var/run/apache.loc* >/dev/null 2>&1
68 msg_not_running apache
70 if [ -x /usr/lib/apache1/lingerd ]; then
71 if [ -f /var/lock/subsys/lingerd ]; then
73 /usr/lib/apache1/lingerd -k && ok || fail
74 rm -f /var/lock/subsys/lingerd >/dev/null 2>&1
76 msg_not_running lingerd
86 apache -t > /dev/null 2>&1
88 if [ $RETVAL -eq 0 ]; then
90 RETVAL=$((RETVAL + $?))
92 RETVAL=$((RETVAL + $?))
95 echo "Configuration file syntax test failed."
100 if [ -f /var/lock/subsys/apache ]; then
103 apache -t > /dev/null 2>&1
105 if [ $RETVAL -eq 0 ]; then
109 echo "Configuration file syntax test failed."
112 msg_not_running apache >&2
117 if [ -f /var/lock/subsys/apache ]; then
120 apache -t > /dev/null 2>&1
122 if [ $RETVAL -eq 0 ]; then
123 killproc apache -USR1
126 echo "Configuration file syntax test failed."
129 msg_not_running apache >&2
137 msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|configtest|status}"