1. 程式人生 > 實用技巧 >原始碼httpd2.4.4安裝

原始碼httpd2.4.4安裝

http的控制指令碼

#!/bin/sh
#set -x
HTTPD='/usr/local/apache2/bin/httpd'
CONFFILE='/usr/local/apache2/conf/httpd.conf'
#description: http server
#chkconfig: 2345 88 60
start(){
[ -f /var/lock/subsys/httpd ]&& echo "apache is started" && exit
echo -n "starting apache......"

sleep 1
$HTTPD -f $CONFFILE && RETVAL=0 ||RETVAL=1
[ $RETVAL -eq 0 ]&& touch /var/lock/subsys/httpd && echo "ok" || echo "fail"



}

stop(){
[ ! -f /var/lock/subsys/httpd ] && echo "httpd is stoped..." && exit
echo -n "stoping httpd........"
sleep 1
/bin/rm -rf /var/lock/subsys/httpd
$HTTPD -k stop && RETVAL=0 ||RETVAL=1
[ $RETVAL -eq 0 ] && rm -rf /var/lock/subsys/httpd && echo "ok" || echo "fail"



}

case $1 in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "start|stop|restart"
;;
esac

轉載於:https://blog.51cto.com/zhangxifan/1166464