nginx安裝啟動停止指令碼

2021-10-09 20:47:57 字數 863 閱讀 5667

目錄前言

一、nginx shell指令碼

nginx安裝啟動(start),停止(stop),獲取狀態(status) 指令碼(shell)

#!/bin/env bash

#應用名稱

#獲取當前shell指令碼路徑

base_dir=`pwd`

echo $base_dir

#nginx檔案所在路徑

nginx_dir=$base_dir/nginx

#nginx程序檔案

pidfile=$nginx_dir/logs/nginx.pid

#nginx啟動指令碼(自身指令碼所在位置)

nginx_shell_path=$nginx_dir/sbin/nginx

#使用說明,用來提示輸入引數

usage() " ]; then

return 1

else

return 0

fi}#啟動方法

start()

#停止方法

stop()

#輸出執行狀態

status()

#重啟

restart()

#根據輸入引數,選擇執行對應方法,不輸入則執行使用說明

case "$1" in

"start")

start

;;"stop")

stop

;;"status")

status

;;"restart")

restart

;;*)

usage

;;esac

Nginx啟動 重啟 停止指令碼

bin sh 將指令碼儲存為 etc rc.d init.d nginxd,便可以使用service命令啟動 停止 重啟nginx服務。source function library etc rc.d init.d functions source networking configuration....

nginx啟動和停止指令碼

bin sh nginx base dir opt nginx nginx daemon sbin nginx nginx conf conf nginx.conf launch signal s dev null checkconfig c t dev null start exit1 check...

Nginx 啟動 停止服務的指令碼

php fastcgi setting host 127.0.0.1 port 9000 childs 5 fast cgi threads default 5 check shell if shell bin bash then echo shell isn t the bash script b...