3 # apache Apache Web Server
6 # description: Apache is a World Wide Web server. It is used to serve \
9 # pidfile: /var/run/httpd.pid
10 # config: /etc/httpd/apache.conf
12 # Source function library
13 . /etc/rc.d/init.d/functions
16 . /etc/sysconfig/network
19 [ -f /etc/sysconfig/httpd ] && . /etc/sysconfig/httpd
21 # Check that networking is up.
22 if is_yes "${NETWORKING}"; then
23 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
24 msg_network_down "Apache 2.2 Web Server"
31 [ -z "$HTTPD_MPM" ] && HTTPD_MPM="prefork"
32 SVC_NAME="Apache 2.2 Web Server ($HTTPD_MPM)"
34 if [ -n "${HTTPD_CONF}" ]; then
35 if [ -d "${HTTPD_CONF}" ] || [ -f "${HTTPD_CONF}" ]; then
36 CFG="-f ${HTTPD_CONF}"
38 echo "error: HTTPD_CONF='$HTTPD_CONF': not a file, not a directory"
44 /usr/sbin/httpd.${HTTPD_MPM} -t $CFG $HTTPD_OPTS >/dev/null 2>&1
49 # Check if the service is already running?
50 if [ ! -f /var/lock/subsys/httpd ]; then
51 msg_starting "$SVC_NAME"
52 daemon --pidfile /var/run/httpd.pid /usr/sbin/httpd.${HTTPD_MPM} $CFG $HTTPD_OPTS
54 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/httpd
56 msg_already_running "$SVC_NAME"
62 if [ -f /var/lock/subsys/httpd ]; then
63 msg_stopping "$SVC_NAME"
64 killproc --pidfile /var/run/httpd.pid httpd.${HTTPD_MPM}
65 rm -f /var/lock/subsys/httpd /var/run/httpd.pid /var/run/httpd.loc* >/dev/null 2>&1
67 msg_not_running "$SVC_NAME"
72 if [ -f /var/lock/subsys/httpd ]; then
76 msg_not_running "$SVC_NAME"
82 # See how we were called.
91 status httpd.${HTTPD_MPM}
93 /usr/sbin/httpd.${HTTPD_MPM} $CFG $HTTPD_OPTS -S
102 reload|force-reload|graceful|flush-logs)
103 if [ -f /var/lock/subsys/httpd ]; then
105 if [ $RETVAL -eq 0 ]; then
106 msg_reloading "$SVC_NAME"; busy
107 /usr/sbin/httpd.${HTTPD_MPM} $CFG $HTTPD_OPTS -k graceful
109 [ $RETVAL -eq 0 ] && ok || fail
111 show "Checking configuration"; busy
113 echo >&2 "Configuration file syntax test failed. Run $0 configtest to see errors."
116 msg_not_running "$SVC_NAME"
121 /usr/sbin/httpd.${HTTPD_MPM} -t $CFG $HTTPD_OPTS
124 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|graceful|configtest|status}"