手寫nginx啟動指令碼

2021-10-07 02:40:26 字數 3543 閱讀 8944

手寫nginx啟動指令碼

- nginx 程序列表 --

----

----

----

----

----

----

----

--tasklist|findstr /i "nginx.exe"

if errorlevel 1

(echo nginx未啟動)

else

(echo nginx已啟動)

echo.---

----

----

----

----

----

----

----

----

----

----

----

----

----

----

----

----

----

----

-echo.

echo.[1

] 啟動nginx

echo.[2

] 關閉nginx

echo.[3

] 重啟nginx

echo.[4

] 退 出

echo.

echo.請輸入選擇專案的序號:

set /p id=

if "%id%"

=="1" goto start

if "%id%"

=="2" goto stop

if "%id%"

=="3" goto restart

if "%id%"

=="4" exit

pause

:start

call :startnginx

echo.===

====

====

====

====

====

====

====

====

====

====

====

====

====

====

====

====

====

====

= echo.

echo.

goto menu

:stop

call :shutdownnginx

echo.===

====

====

====

====

====

====

====

====

====

====

====

====

====

====

====

====

====

====

= echo.

echo.

goto menu

:restart

call :shutdownnginx

call :startnginx

echo.===

====

====

====

====

====

====

====

====

====

====

====

====

====

====

====

====

====

====

= echo.

echo.

goto menu

:shutdownnginx

echo.

echo.關閉nginx...

... taskkill /f /im nginx.exe > nul

echo.ok,關閉所有nginx 程序

goto

:eof

:startnginx

echo.

echo.啟動nginx...

... if not exist "%nginx_dir%nginx.exe" echo "%nginx_dir%nginx.exe"不存在

%nginx_path%

cd "%nginx_dir%"

if exist "%nginx_dir%nginx.exe"

( echo "start '' nginx.exe"

start "" nginx.exe

) echo.ok

goto

:eof

將上面指令碼複製到新建的.bat檔案中更改為自己nginx安裝路徑即可測試(windows環境下),啟動介面如下:

Nginx啟動指令碼

nginx啟動指令碼 nginx engine x 是乙個高效能的http和反向 伺服器,也是乙個 imap pop3 smtp 伺服器。因穩定性 豐富的功能 低資源消耗而聞名。但nginx本身不自帶啟動指令碼,需要我們手動編寫乙份,現在網上所提供的大多數指令碼都是有針對行的,可移植性很差。大多數這...

Nginx啟動指令碼

nginx啟動指令碼 nginx engine x 是乙個高效能的http和反向 伺服器,也是乙個 imap pop3 smtp 伺服器。因穩定性 豐富的功能 低資源消耗而聞名。但nginx本身不自帶啟動指令碼,需要我們手動編寫乙份,現在網上所提供的大多數指令碼都是有針對行的,可移植性很差。大多數這...

nginx 啟動指令碼

相信好多小夥伴啟動nginx和重啟的時候都需要在命令列輸入命令,本著程式猿封裝思想 咱們可以寫好指令碼這樣就一勞永逸了。echo off cd d d nginx 1.5.1 這是nginx的安裝路徑 start nginx.exe exit echo off d cd d nginx 1.5.1 ...