首页 > 代码库 > http2.4 的启动脚本

http2.4 的启动脚本

#!/bin/bash

# httpd starts/stop the at daemon

#chkconfig: 345 61 29
#description: runs apache as httpd

#Source function library
. /etc/init.d/functions

exec=/usr/local/apache2/bin/httpd
prog="httpd"

config=/usr/local/apache2/conf/httpd.conf

lockfile=/var/lock/subsys/$prog

start()
{
[ -x $exec ] || exit 5
[ -f $config ] || exit 6
[ -f $lockfile ] && echo "http have running...." && exit 7
echo -n $"Starting $prog ....... "
sleep 1
$exec -k start
[ $? -eq 0 ] && touch $lockfile && echo -e " \033[31m OK \033[0m" || echo -e "\033[31m Failure \033[0m"

}


stop()
{
echo -n "httpd is stoping......."
sleep 1
killproc $prog > /dev/null && rm -f $lockfile && echo -e " \033[31m OK \033[0m " || echo -e "\033[31m Faiure stop \033[0m "

}


restart()
{
stop
start

}

status()

{
[ -f $lockfile ] && echo "httpd is running........" || echo "httpd have stoping......."
}


case "$1" in
start)
start;;
stop)
stop;;
restart)
restart;;
status)
status;;
*)
echo "Usage ./httpd {start|stop|restart|status}"
;;
esac

 

http2.4 的启动脚本