标签:des http io ar sp on art cti amp
#!/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
标签:des http io ar sp on art cti amp
原文地址:http://www.cnblogs.com/xiaoxiaoguixia/p/4034197.html