87 lines
2.0 KiB
Bash
87 lines
2.0 KiB
Bash
#!/bin/bash
|
|
#
|
|
# httpd -- startup script for the Apache Web Server
|
|
#
|
|
# chkconfig: 2345 55 15
|
|
# description: Apache is a World Wide Web server. It is used to serve \
|
|
# HTML files and CGI.
|
|
# processname: httpd
|
|
# pidfile: /run/httpd/httpd.pid
|
|
# config: /etc/httpd/conf/httpd.conf
|
|
|
|
. /etc/sysconfig/rc
|
|
|
|
# Source function library.
|
|
[ -r "$rc_functions" ] && . $rc_functions
|
|
|
|
NAME=httpd
|
|
DAEMON=/usr/sbin/$NAME
|
|
DAEMONPID=/run/httpd/$NAME.pid
|
|
DAEMONCONF=/etc/httpd/httpd.conf
|
|
OPTIONS=
|
|
|
|
# Path to the apachectl script, server binary, and short-form for messages.
|
|
APACHECTL=/usr/sbin/apachectl
|
|
|
|
[ -x $DAEMON ] || exit 0
|
|
|
|
# This will prevent initlog from swallowing up a pass-phrase prompt if
|
|
# mod_ssl needs a pass-phrase from the user.
|
|
INITLOG_ARGS=""
|
|
|
|
# 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.
|
|
|
|
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
|
|
|
|
[ -r $DAEMONCONF ] || exit 0
|
|
|
|
RETVAL=0
|
|
|
|
# See how we were called.
|
|
case "$1" in
|
|
start)
|
|
echo -n $"Starting $NAME: "
|
|
daemon --pidfile=$DAEMONPID $DAEMON $OPTIONS
|
|
RETVAL=$?
|
|
echo
|
|
[ $RETVAL = 0 ] && touch /var/lock/subsys/$NAME
|
|
;;
|
|
stop)
|
|
echo -n $"Stopping $NAME: "
|
|
killproc -p $DAEMONPID $DAEMON
|
|
RETVAL=$?
|
|
echo
|
|
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/$NAME $DAEMONPID
|
|
;;
|
|
status)
|
|
statusproc $DAEMON
|
|
RETVAL=$?
|
|
;;
|
|
restart|force-reload)
|
|
$0 stop
|
|
sleep 1
|
|
$0 start
|
|
;;
|
|
condrestart)
|
|
[ -e /var/lock/subsys/$NAME ] && $0 restart || :
|
|
;;
|
|
reload)
|
|
echo -n $"Reloading $NAME: "
|
|
reloadproc $DAEMON -HUP
|
|
RETVAL=$?
|
|
echo
|
|
;;
|
|
graceful|help|configtest|fullstatus)
|
|
$APACHECTL $@
|
|
RETVAL=$?
|
|
;;
|
|
*)
|
|
echo $"Usage: ""$0 {start|stop|restart|condrestart|reload|status|graceful|help|configtest|fullstatus}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit $RETVAL
|