当前位置: > Linux服务器 > apache >

httpd启动脚本

时间:2014-10-18 17:30来源:linux.it.net.cn 作者:it


没错,这里为你提供的是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


(责任编辑:IT)
------分隔线----------------------------