首页 > 其他 > 详细

nginx启动脚本

时间:2019-11-07 15:32:22      阅读:82      评论:0      收藏:0      [点我收藏+]

#!/bin/bash
#chkconfig 2345 99 20
#2345表示系统运行级别
#99表示启动优先级
#20表示关闭的优先级
nginx=/usr/local/nginx/sbin/nginx
case $1 in
start)
netstat -anptu|grep nginx
if [ $? -eq 0 ]; then
echo "nginx server is already running"
else
echo "nginx server begin start...."
$nginx

fi
;;
stop)
$nginx -s stop
if [ $? -eq 0 ]; then
echo "nginx server is stop"
else
echo "nginx server stop fail,try again!"
fi
;;
status)
netstat -anptu|grep nginx
if [ $? -eq 0 ]; then
echo "nginx server is running"
else
echo "nginx server is stoped"
fi
;;
restart)
$nginx -s reload
if [ $? -eq 0 ]; then
echo "nginx server is begin restart"
else
echo "nginx server restart fail!"
fi
;;
*)
echo "please enter {start|restart|status|stop}"
;;
esac

nginx启动脚本

原文:https://www.cnblogs.com/baby0123/p/11811593.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!