注:有問題或更好可以一起**謝謝
#!/bin/bash
nginx=/usr/local/nginx/sbin/nginx
echo
"nginx一鍵啟動,停止,檢視....."
read -ep "請輸入你的操作,1.stop,2.start,3.reload,4.status(1,2,3,4):" nginx1
case $nginx1 in
1)netstat -nlpt | grep nginx > /dev/null
if[ $? -eq 0 ]
;then
pkill -15 nginx
echo
"nginx成功停止..."
else
echo
"nginx沒有啟動請檢查..."fi;
;2)netstat -nlpt | grep nginx &> /dev/null
if[ $? -eq 0 ]
;then
echo
"已經啟動nginx..."
else
echo
"nginx正在啟動中...."
$nginx
echo
"啟動成功."fi;
;3)read -ep "警告是否重新啟動nginx....(yes/no)" nginif[
$ngin == "yes"
];then
netstat -nlpt | grep nginx > /dev/null
if[ $? -eq 0 ]
;then
echo
"nginx正在重新啟動中...."
/usr/local/nginx/sbin/nginx -s reload
echo
"重新啟動成功...."
else
echo
"nginx沒有啟動無法重新啟動...."
fielse
echo
"選擇成功正在退出...."
exitfi;
;4)echo
"狀態如下..."
netstat -nlpt | grep nginx;;
esac
Nginx啟動 重啟 停止指令碼
bin sh 將指令碼儲存為 etc rc.d init.d nginxd,便可以使用service命令啟動 停止 重啟nginx服務。source function library etc rc.d init.d functions source networking configuration....
es集群一鍵安裝 啟動 停止指令碼
es集群一鍵安裝指令碼 bin bash 配置es的安裝目錄 修改的地方1 指令碼可以自己建立 currenttime date y m d h m s echo e 請輸入es的安裝目錄,不存在指令碼自動建立,最後乙個 不要寫 bigdata install read esinstallpath ...
Nginx 啟動 停止 重啟
例如 root linuxserver sbin usr local nginx sbin nginx c usr local nginx conf nginx.conf 停止nginx的停止有三種方式 從容停止 1 檢視程序號 root linuxserver ps ef grep nginx 2...