nginx启动脚本

#!/bin/bash
# chkconfig: 2345 99 20
# description: Nginx Server Control Scripts shell
PROG="/usr/local/nginx/sbin/nginx"
PIDF="/usr/local/nginx/logs/nginx.pid"
case "$1" in
start)
if [ -f $PIDF ];then
echo "Nginx is running...Start it is error"
else
$PROG
fi
;;
stop)
if [ -f $PIDF ];then
kill -3 $(cat $PIDF)
rm -f $PIDF
else
echo "Nginx is stopping...Stop it is error"
fi
;;
restart)
$0 stop
$0 start
;;
reload)
if [ -f $PIDF ];then
kill -1 $(cat $PIDF)
else
echo "Nginx is stopping...reload it is error"
fi
;;
status)
if [ -f $PIDF ];then
echo "Nginx is running"
else
echo "Nginx is stopped"
fi
;;
*)
echo "Usage:$0 (start|stop|restart|reload|status)"
exit 1
esac
exit 0

posted @ 2017-08-04 16:54  underwaterSwimming  阅读(136)  评论(0编辑  收藏  举报