nginx啟動腳本


#!/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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM