httpd启动脚本

发布时间:2019-09-22编辑:脚本学堂
httpd启动脚本

众里寻她千百度,蓦然回首,脚本就在此处,哈哈。
没错,这里为你提供的是httpd的启动脚本,仅供参考。

复制代码 代码如下:

#!/bin/bash
# Startup script for the apache Web Server
# chkconfig: 345 85 15
# description: Apache is a World Wide Web server.
# Source function library.
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/httpd ]; then
       . /etc/sysconfig/httpd
fi

INITLOG_ARGS=""

apachectl=/usr/local/apache2/bin/apachectl
httpd=${HTTPD-/usr/local/apache2/bin/httpd}
prog=httpd
RETVAL=0

start() {
       echo -n $"Starting $prog: "
       daemon $httpd $OPTIONS
       RETVAL=$?
       echo
       [ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
       return $RETVAL
}
stop() {
       echo -n $"Stopping $prog: "
       killproc $httpd
       RETVAL=$?
       echo
       [ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid
}
reload() {
       echo -n $"Reloading $prog: "
       killproc $httpd -HUP
       RETVAL=$?
       echo
}

case "$1" in
 start)
       start
 ;;
 stop)
       stop
       ;;
 status)
       status $httpd
       RETVAL=$?
       ;;
 restart)
       stop
       start
       ;;
 condrestart)
       if [ -f /var/run/httpd.pid ] ; then
               stop
               start
       fi
       ;;
 reload)
       reload
       ;;
 graceful|help|configtest|fullstatus)
       $apachectl $@
       RETVAL=$?
       ;;
 *)
       echo $"Usage: $prog

{start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
       exit 1
esac

exit $RETVAL