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 1.3 Web Server"
32 if is_no "${IPV6_NETWORKING}"; then
33 HTTPD_OPTS="$HTTPD_OPTS -4"
40 # wrapper for configtest
44 if [ $details = 1 ]; then
45 # run config test and display report (status action)
46 show "Checking %s configuration" "Apache 1.3 Web Server"; busy
50 if [ $RETVAL = 0 ]; then
55 [ "$out" ] && echo >&2 "$out"
57 # run config test and abort with nice message if failed
58 # (for actions checking status before action).
59 configtest >/dev/null 2>&1
61 if [ $RETVAL != 0 ]; then
62 show "Checking %s configuration" "Apache 1.3 Web Server"; fail
63 nls 'Configuration test failed. See details with %s "checkconfig"' $0
70 # Check if the service is already running?
71 if [ -x /usr/lib/apache1/lingerd ]; then
72 if [ ! -f /var/lock/subsys/lingerd ]; then
73 msg_starting "Apache Lingerd"
74 SERVICE_UMASK=002 daemon --user http /usr/lib/apache1/lingerd
76 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lingerd
78 msg_already_running "Apache Lingerd"
82 if [ -f /var/lock/subsys/apache ]; then
83 msg_already_running "Apache 1.3 Web Server"
88 msg_starting "Apache 1.3 Web Server"
89 daemon /usr/sbin/apache $HTTPD_OPTS
91 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/apache
96 if [ -f /var/lock/subsys/apache ]; then
97 msg_stopping "Apache 1.3 Web Server"
98 killproc --pidfile /var/run/apache.pid apache
99 rm -f /var/lock/subsys/apache /var/run/apache.pid /var/run/apache.loc* >/dev/null 2>&1
101 msg_not_running "Apache 1.3 Web Server"
103 if [ -x /usr/lib/apache1/lingerd ]; then
104 if [ -f /var/lock/subsys/lingerd ]; then
105 msg_stopping "Apache Lingerd"
106 /usr/lib/apache1/lingerd -k && ok || fail
107 rm -f /var/lock/subsys/lingerd >/dev/null 2>&1
109 msg_not_running "Apache Lingerd"
117 if [ ! -f /var/lock/subsys/apache ]; then
118 msg_not_running "Apache 1.3 Web Server"
124 msg_reloading "Apache 1.3 Web Server"
125 killproc --pidfile /var/run/apache.pid apache -$sig
130 if [ ! -f /var/lock/subsys/apache ]; then
131 msg_not_running "Apache 1.3 Web Server"
142 # See how we were called.
167 checkconfig|configtest)
176 msg_usage "$0 {start|stop|restart|try-restart|reload|graceful|force-reload|checkconfig|status}"