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/conf/access.conf
11 # config: /etc/httpd/conf/httpd.conf
12 # config: /etc/httpd/conf/srm.conf
15 # Source function library
16 . /etc/rc.d/init.d/functions
19 . /etc/sysconfig/network
22 [ -f /etc/sysconfig/httpd ] && . /etc/sysconfig/httpd
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 msg_network_down httpd
34 [ -z "$HTTPD_MPM" ] && HTTPD_MPM="prefork"
36 if [ -n "${HTTPD_CONF}" ]; then
37 if [ -d "${HTTPD_CONF}" ] || [ -f "${HTTPD_CONF}" ]; then
38 CFG="-f ${HTTPD_CONF}"
40 echo "error: HTTPD_CONF='$HTTPD_CONF': not a file, not a directory"
46 # See how we were called.
49 # Check if the service is already running?
50 if [ ! -f /var/lock/subsys/httpd ]; then
51 msg_starting httpd.${HTTPD_MPM}
52 daemon httpd.${HTTPD_MPM} $CFG $HTTPD_OPTS
54 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/httpd
56 msg_already_running httpd.${HTTPD_MPM}
61 if [ -f /var/lock/subsys/httpd ]; then
62 msg_stopping httpd.${HTTPD_MPM}
63 [ -n "$(pidofproc httpd.${HTTPD_MPM})" ] && OPT="--waitforname httpd.${HTTPD_MPM} --waitfortime 60" || OPT=
64 killproc --pidfile httpd.pid $OPT httpd.${HTTPD_MPM}
65 # Delete pidfile only when apache was called successfully
67 rm -f /var/lock/subsys/httpd /var/run/httpd.pid /var/run/httpd.loc* >/dev/null 2>&1
70 msg_not_running httpd.${HTTPD_MPM}
74 status httpd.${HTTPD_MPM}
76 /usr/sbin/httpd.${HTTPD_MPM} $CFG -S
82 reload|force-reload|graceful)
83 if [ -f /var/lock/subsys/httpd ]; then
84 run_cmd "Checking httpd.${HTTPD_MPM} configuration" httpd.${HTTPD_MPM} $CFG -t
86 if [ $RETVAL -eq 0 ]; then
87 msg_reloading httpd.${HTTPD_MPM}
88 daemon httpd.${HTTPD_MPM} $CFG -k graceful
92 msg_not_running httpd.${HTTPD_MPM} >&2
97 msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|status}"