|
cvsdist |
3cbd43b |
#!/bin/bash
|
|
cvsdist |
3cbd43b |
#
|
|
cvsdist |
6356941 |
# httpd Startup script for the Apache HTTP Server
|
|
cvsdist |
3cbd43b |
#
|
|
cvsdist |
3cbd43b |
# chkconfig: - 85 15
|
|
|
935b958 |
# description: The Apache HTTP Server is an efficient and extensible \
|
|
|
935b958 |
# server implementing the current HTTP standards.
|
|
cvsdist |
3cbd43b |
# processname: httpd
|
|
cvsdist |
3cbd43b |
# config: /etc/httpd/conf/httpd.conf
|
|
cvsdist |
6356941 |
# config: /etc/sysconfig/httpd
|
|
cvsdist |
6356941 |
# pidfile: /var/run/httpd.pid
|
|
|
935b958 |
#
|
|
|
935b958 |
### BEGIN INIT INFO
|
|
|
935b958 |
# Provides: httpd
|
|
|
935b958 |
# Required-Start: $local_fs $remote_fs $network $named
|
|
|
935b958 |
# Required-Stop: $local_fs $remote_fs $network
|
|
|
935b958 |
# Should-Start: distcache
|
|
|
935b958 |
# Short-Description: start and stop Apache HTTP Server
|
|
|
935b958 |
# Description: The Apache HTTP Server is an extensible server
|
|
|
935b958 |
# implementing the current HTTP standards.
|
|
|
935b958 |
### END INIT INFO
|
|
cvsdist |
3cbd43b |
|
|
cvsdist |
3cbd43b |
# Source function library.
|
|
cvsdist |
3cbd43b |
. /etc/rc.d/init.d/functions
|
|
cvsdist |
3cbd43b |
|
|
cvsdist |
3cbd43b |
if [ -f /etc/sysconfig/httpd ]; then
|
|
cvsdist |
3cbd43b |
. /etc/sysconfig/httpd
|
|
cvsdist |
3cbd43b |
fi
|
|
cvsdist |
3cbd43b |
|
|
cvsdist |
53326aa |
# Start httpd in the C locale by default.
|
|
cvsdist |
53326aa |
HTTPD_LANG=${HTTPD_LANG-"C"}
|
|
cvsdist |
53326aa |
|
|
cvsdist |
3cbd43b |
# This will prevent initlog from swallowing up a pass-phrase prompt if
|
|
cvsdist |
3cbd43b |
# mod_ssl needs a pass-phrase from the user.
|
|
cvsdist |
3cbd43b |
INITLOG_ARGS=""
|
|
cvsdist |
3cbd43b |
|
|
cvsdist |
f8e1fe3 |
# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
|
|
cvsdist |
f8e1fe3 |
# with the thread-based "worker" MPM; BE WARNED that some modules may not
|
|
cvsdist |
f8e1fe3 |
# work correctly with a thread-based MPM; notably PHP will refuse to start.
|
|
cvsdist |
f8e1fe3 |
|
|
cvsdist |
3cbd43b |
# Path to the apachectl script, server binary, and short-form for messages.
|
|
cvsdist |
3cbd43b |
apachectl=/usr/sbin/apachectl
|
|
cvsdist |
f8e1fe3 |
httpd=${HTTPD-/usr/sbin/httpd}
|
|
cvsdist |
3cbd43b |
prog=httpd
|
|
cvsdist |
3ebc88d |
pidfile=${PIDFILE-/var/run/httpd.pid}
|
|
cvsdist |
3ebc88d |
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
|
|
cvsdist |
3cbd43b |
RETVAL=0
|
|
cvsdist |
3cbd43b |
|
|
cvsdist |
3cbd43b |
# The semantics of these two functions differ from the way apachectl does
|
|
cvsdist |
3cbd43b |
# things -- attempting to start while running is a failure, and shutdown
|
|
cvsdist |
3cbd43b |
# when not running is also a failure. So we just do it the way init scripts
|
|
cvsdist |
3cbd43b |
# are expected to behave here.
|
|
cvsdist |
3cbd43b |
start() {
|
|
cvsdist |
3cbd43b |
echo -n $"Starting $prog: "
|
|
|
935b958 |
LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
|
|
cvsdist |
3cbd43b |
RETVAL=$?
|
|
cvsdist |
3cbd43b |
echo
|
|
cvsdist |
3ebc88d |
[ $RETVAL = 0 ] && touch ${lockfile}
|
|
cvsdist |
3cbd43b |
return $RETVAL
|
|
cvsdist |
3cbd43b |
}
|
|
|
81d733c |
|
|
|
81d733c |
# When stopping httpd a delay of >10 second is required before SIGKILLing the
|
|
|
81d733c |
# httpd parent; this gives enough time for the httpd parent to SIGKILL any
|
|
|
81d733c |
# errant children.
|
|
cvsdist |
3cbd43b |
stop() {
|
|
cvsdist |
3cbd43b |
echo -n $"Stopping $prog: "
|
|
|
935b958 |
killproc -p ${pidfile} -d 10 $httpd
|
|
cvsdist |
3cbd43b |
RETVAL=$?
|
|
cvsdist |
3cbd43b |
echo
|
|
cvsdist |
3ebc88d |
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
|
|
cvsdist |
3cbd43b |
}
|
|
cvsdist |
3cbd43b |
reload() {
|
|
|
3eb2bca |
echo -n $"Reloading $prog: "
|
|
|
3eb2bca |
if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
|
|
|
7c0f3e4 |
RETVAL=$?
|
|
|
4435419 |
echo $"not reloading due to configuration syntax error"
|
|
|
22b6740 |
failure $"not reloading $httpd due to configuration syntax error"
|
|
|
7c0f3e4 |
else
|
|
|
935b958 |
killproc -p ${pidfile} $httpd -HUP
|
|
|
7c0f3e4 |
RETVAL=$?
|
|
|
7c0f3e4 |
fi
|
|
|
3eb2bca |
echo
|
|
cvsdist |
3cbd43b |
}
|
|
cvsdist |
3cbd43b |
|
|
cvsdist |
3cbd43b |
# See how we were called.
|
|
cvsdist |
3cbd43b |
case "$1" in
|
|
cvsdist |
3cbd43b |
start)
|
|
cvsdist |
3cbd43b |
start
|
|
cvsdist |
3cbd43b |
;;
|
|
cvsdist |
3cbd43b |
stop)
|
|
cvsdist |
3cbd43b |
stop
|
|
cvsdist |
3cbd43b |
;;
|
|
cvsdist |
3cbd43b |
status)
|
|
cvsdist |
3cbd43b |
status $httpd
|
|
cvsdist |
3cbd43b |
RETVAL=$?
|
|
cvsdist |
3cbd43b |
;;
|
|
cvsdist |
3cbd43b |
restart)
|
|
cvsdist |
3cbd43b |
stop
|
|
cvsdist |
3cbd43b |
start
|
|
cvsdist |
3cbd43b |
;;
|
|
cvsdist |
3cbd43b |
condrestart)
|
|
cvsdist |
3ebc88d |
if [ -f ${pidfile} ] ; then
|
|
cvsdist |
3cbd43b |
stop
|
|
cvsdist |
3cbd43b |
start
|
|
cvsdist |
3cbd43b |
fi
|
|
cvsdist |
3cbd43b |
;;
|
|
|
935b958 |
force-reload|reload)
|
|
cvsdist |
3cbd43b |
reload
|
|
cvsdist |
3cbd43b |
;;
|
|
cvsdist |
3cbd43b |
graceful|help|configtest|fullstatus)
|
|
cvsdist |
e9bfb00 |
$apachectl $@
|
|
cvsdist |
3cbd43b |
RETVAL=$?
|
|
cvsdist |
3cbd43b |
;;
|
|
cvsdist |
3cbd43b |
*)
|
|
cvsdist |
3cbd43b |
echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
|
|
|
935b958 |
RETVAL=3
|
|
cvsdist |
3cbd43b |
esac
|
|
cvsdist |
3cbd43b |
|
|
cvsdist |
3cbd43b |
exit $RETVAL
|