cvsdist 3cbd43b
#!/bin/bash
cvsdist 3cbd43b
#
cvsdist 6356941
# httpd        Startup script for the Apache HTTP Server
cvsdist 3cbd43b
#
cvsdist 3cbd43b
# chkconfig: - 85 15
cvsdist 3cbd43b
# description: Apache is a World Wide Web server.  It is used to serve \
cvsdist 3cbd43b
#	       HTML files and CGI.
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
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
# check for 1.3 configuration
cvsdist 3cbd43b
check13 () {
cvsdist 3cbd43b
	CONFFILE=/etc/httpd/conf/httpd.conf
cvsdist 3cbd43b
	GONE="(ServerType|BindAddress|Port|AddModule|ClearModuleList|"
cvsdist 3cbd43b
	GONE="${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|"
cvsdist 3cbd43b
	GONE="${GONE}AccessConfig|ResourceConfig)"
cvsdist 53326aa
	if LANG=C grep -Eiq "^[[:space:]]*($GONE)" $CONFFILE; then
cvsdist 3cbd43b
		echo
cvsdist d5ddf48
		echo 1>&2 " Apache 1.3 configuration directives found"
cvsdist 3cbd43b
		echo 1>&2 " please read @docdir@/migration.html"
cvsdist d5ddf48
		failure "Apache 1.3 config directives test"
cvsdist 3cbd43b
		echo
cvsdist 3cbd43b
		exit 1
cvsdist 3cbd43b
	fi
cvsdist 3cbd43b
}
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: "
cvsdist 3cbd43b
        check13 || exit 1
cvsdist 53326aa
        LANG=$HTTPD_LANG daemon $httpd $OPTIONS
cvsdist 3cbd43b
        RETVAL=$?
cvsdist 3cbd43b
        echo
cvsdist 3ebc88d
        [ $RETVAL = 0 ] && touch ${lockfile}
cvsdist 3cbd43b
        return $RETVAL
cvsdist 3cbd43b
}
cvsdist 3cbd43b
stop() {
cvsdist 3cbd43b
	echo -n $"Stopping $prog: "
cvsdist 3cbd43b
	killproc $httpd
cvsdist 3cbd43b
	RETVAL=$?
cvsdist 3cbd43b
	echo
cvsdist 3ebc88d
	[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
cvsdist 3cbd43b
}
cvsdist 3cbd43b
reload() {
cvsdist 3cbd43b
	echo -n $"Reloading $prog: "
cvsdist 3cbd43b
	check13 || exit 1
cvsdist 3cbd43b
	killproc $httpd -HUP
cvsdist 3cbd43b
	RETVAL=$?
cvsdist 3cbd43b
	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
	;;
cvsdist 3cbd43b
  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}"
cvsdist 3cbd43b
	exit 1
cvsdist 3cbd43b
esac
cvsdist 3cbd43b
cvsdist 3cbd43b
exit $RETVAL