# vi /etc/init.d/nginx
#!/bin/bash
###############################################
#Chkconfig: - 99 20
#Datetime: 2011-11-22
#Email: penghjfy@126.com
#Author: Dandy
#Description: Nginx Service Control Script
###############################################
chk="ps aux|grep nginx|grep -v grep"
case "$1" in
start)
/iCSP/res/nginx/sbin/nginx
;;
stop)
/usr/bin/killall -s QUIT nginx
;;
restart)
$0 stop
$0 start
;;
reload)
/iCSP/res/nginx/sbin/nginx -s reload
;;
check)
echo "-----------Run Status Query ^-----------"
echo $chk
eval "$chk"
echo "-----------Run Status Query \$-----------"
;;
*)
echo "Usage:$0 {start|stop|restart|reload}"
exit 1
esac
exit 0
# chmod a+x /etc/init.d/nginx
# chkconfig --add nginx
# chkconfig --level 2345 nginx on
# chkconfig --list |grep nginx
转载于:https://blog.51cto.com/penghjfy/721587