Nginx添加系统服务

2015-12-2322:31:52Nginx添加系统服务已关闭评论 643

#!/bin/bash
# chkconfig: 345 96 20
# description: Nginx service
PROG="/usr/sbin/nginx"
PIDF="/var/run/nginx.pid"
case "$1" in
start)
$PROG
echo "Nginx servicestart success."
;;
stop)
kill -s QUIT $(cat $PIDF)
echo "Nginx service stopsuccess."
;;
restart)
$0 stop
$0 start
;;
reload)
kill -s HUP $(cat $PIDF)
echo"reload Nginx configsuccess."
;;
*)
echo "Usage: $0{start|stop|restart|reload}"
exit 1
esac