2004-09-09 06:08:44 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2004-09-09 06:16:56 +00:00
|
|
|
# httpd Startup script for the Apache HTTP Server
|
2004-09-09 06:08:44 +00:00
|
|
|
#
|
|
|
|
# chkconfig: - 85 15
|
|
|
|
# description: Apache is a World Wide Web server. It is used to serve \
|
|
|
|
# HTML files and CGI.
|
|
|
|
# processname: httpd
|
|
|
|
# config: /etc/httpd/conf/httpd.conf
|
2004-09-09 06:16:56 +00:00
|
|
|
# config: /etc/sysconfig/httpd
|
|
|
|
# pidfile: /var/run/httpd.pid
|
2004-09-09 06:08:44 +00:00
|
|
|
|
|
|
|
# Source function library.
|
|
|
|
. /etc/rc.d/init.d/functions
|
|
|
|
|
|
|
|
if [ -f /etc/sysconfig/httpd ]; then
|
|
|
|
. /etc/sysconfig/httpd
|
|
|
|
fi
|
|
|
|
|
2004-09-09 06:21:42 +00:00
|
|
|
# Start httpd in the C locale by default.
|
|
|
|
HTTPD_LANG=${HTTPD_LANG-"C"}
|
|
|
|
|
2004-09-09 06:08:44 +00:00
|
|
|
# This will prevent initlog from swallowing up a pass-phrase prompt if
|
|
|
|
# mod_ssl needs a pass-phrase from the user.
|
|
|
|
INITLOG_ARGS=""
|
|
|
|
|
2004-09-09 06:12:16 +00:00
|
|
|
# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
|
|
|
|
# with the thread-based "worker" MPM; BE WARNED that some modules may not
|
|
|
|
# work correctly with a thread-based MPM; notably PHP will refuse to start.
|
|
|
|
|
2004-09-09 06:08:44 +00:00
|
|
|
# Path to the apachectl script, server binary, and short-form for messages.
|
|
|
|
apachectl=/usr/sbin/apachectl
|
2004-09-09 06:12:16 +00:00
|
|
|
httpd=${HTTPD-/usr/sbin/httpd}
|
2004-09-09 06:08:44 +00:00
|
|
|
prog=httpd
|
2004-09-09 06:17:21 +00:00
|
|
|
pidfile=${PIDFILE-/var/run/httpd.pid}
|
|
|
|
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
|
2004-09-09 06:08:44 +00:00
|
|
|
RETVAL=0
|
|
|
|
|
|
|
|
# check for 1.3 configuration
|
|
|
|
check13 () {
|
|
|
|
CONFFILE=/etc/httpd/conf/httpd.conf
|
|
|
|
GONE="(ServerType|BindAddress|Port|AddModule|ClearModuleList|"
|
|
|
|
GONE="${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|"
|
|
|
|
GONE="${GONE}AccessConfig|ResourceConfig)"
|
2004-09-09 06:21:42 +00:00
|
|
|
if LANG=C grep -Eiq "^[[:space:]]*($GONE)" $CONFFILE; then
|
2004-09-09 06:08:44 +00:00
|
|
|
echo
|
2004-09-09 06:09:30 +00:00
|
|
|
echo 1>&2 " Apache 1.3 configuration directives found"
|
2004-09-09 06:08:44 +00:00
|
|
|
echo 1>&2 " please read @docdir@/migration.html"
|
2004-09-09 06:09:30 +00:00
|
|
|
failure "Apache 1.3 config directives test"
|
2004-09-09 06:08:44 +00:00
|
|
|
echo
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# The semantics of these two functions differ from the way apachectl does
|
|
|
|
# things -- attempting to start while running is a failure, and shutdown
|
|
|
|
# when not running is also a failure. So we just do it the way init scripts
|
|
|
|
# are expected to behave here.
|
|
|
|
start() {
|
|
|
|
echo -n $"Starting $prog: "
|
|
|
|
check13 || exit 1
|
2004-09-09 06:21:42 +00:00
|
|
|
LANG=$HTTPD_LANG daemon $httpd $OPTIONS
|
2004-09-09 06:08:44 +00:00
|
|
|
RETVAL=$?
|
|
|
|
echo
|
2004-09-09 06:17:21 +00:00
|
|
|
[ $RETVAL = 0 ] && touch ${lockfile}
|
2004-09-09 06:08:44 +00:00
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
stop() {
|
|
|
|
echo -n $"Stopping $prog: "
|
|
|
|
killproc $httpd
|
|
|
|
RETVAL=$?
|
|
|
|
echo
|
2004-09-09 06:17:21 +00:00
|
|
|
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
|
2004-09-09 06:08:44 +00:00
|
|
|
}
|
|
|
|
reload() {
|
2005-02-07 15:14:50 +00:00
|
|
|
echo -n $"Reloading $prog: "
|
|
|
|
if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
|
2004-11-18 11:59:52 +00:00
|
|
|
RETVAL=$?
|
2005-03-02 08:17:41 +00:00
|
|
|
echo $"not reloading due to configuration syntax error"
|
|
|
|
failure $"Not reloading $httpd due to configuration syntax errors"
|
2004-11-18 11:59:52 +00:00
|
|
|
else
|
|
|
|
killproc $httpd -HUP
|
|
|
|
RETVAL=$?
|
|
|
|
fi
|
2005-02-07 15:14:50 +00:00
|
|
|
echo
|
2004-09-09 06:08:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# See how we were called.
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
stop
|
|
|
|
;;
|
|
|
|
status)
|
|
|
|
status $httpd
|
|
|
|
RETVAL=$?
|
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
stop
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
condrestart)
|
2004-09-09 06:17:21 +00:00
|
|
|
if [ -f ${pidfile} ] ; then
|
2004-09-09 06:08:44 +00:00
|
|
|
stop
|
|
|
|
start
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
reload)
|
|
|
|
reload
|
|
|
|
;;
|
|
|
|
graceful|help|configtest|fullstatus)
|
2004-09-09 06:22:47 +00:00
|
|
|
$apachectl $@
|
2004-09-09 06:08:44 +00:00
|
|
|
RETVAL=$?
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit $RETVAL
|