Windows 에서 nginx 의 시작, 재 부팅, 닫 기 기능

3251 단어
@echo off
rem   Windows nginx   ,  ,    
 
echo ==================begin========================
 
cls 
::ngxin      
set NGINX_PATH=E:
 
::nginx     
set NGINX_DIR=E:\service\1
ginx-1.16.0\ color 0a TITLE Nginx CLS echo. echo. ** Nginx *** echo. *** create 2019-09-10 *** echo. :MENU echo. ***** nginx list ****** ::tasklist|findstr /i "nginx.exe" tasklist /fi "imagename eq nginx.exe" echo. if ERRORLEVEL 1 ( echo nginx.exe ) else ( echo nginx.exe ) echo. ::************************************************************************************************************* echo. echo. [1] Nginx echo. [2] Nginx echo. [3] Nginx echo. [4] echo. [5] Nginx echo. [6] nginx echo. [7] nginx version echo. [0] echo. echo. : set /p ID= IF "%id%"=="1" GOTO start IF "%id%"=="2" GOTO stop IF "%id%"=="3" GOTO restart IF "%id%"=="4" GOTO MENU IF "%id%"=="5" GOTO reloadConf IF "%id%"=="6" GOTO checkConf IF "%id%"=="7" GOTO showVersion IF "%id%"=="0" EXIT PAUSE ::************************************************************************************************************* :: :start call :startNginx GOTO MENU :: :stop call :shutdownNginx GOTO MENU :: :restart call :shutdownNginx call :startNginx GOTO MENU :: :checkConf call :checkConfNginx GOTO MENU :: Nginx :reloadConf call :checkConfNginx call :reloadConfNginx GOTO MENU :: nginx :showVersion call :showVersionNginx 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" goto :eof ) %NGINX_PATH% cd "%NGINX_DIR%" IF EXIST "%NGINX_DIR%nginx.exe" ( echo "start '' nginx.exe" start "" nginx.exe ) echo.OK goto :eof :checkConfNginx echo. echo. nginx ...... IF NOT EXIST "%NGINX_DIR%nginx.exe" ( echo "%NGINX_DIR%nginx.exe" goto :eof ) %NGINX_PATH% cd "%NGINX_DIR%" nginx -t -c conf/nginx.conf goto :eof :: nginx :reloadConfNginx echo. echo. nginx ...... IF NOT EXIST "%NGINX_DIR%nginx.exe" ( echo "%NGINX_DIR%nginx.exe" goto :eof ) %NGINX_PATH% cd "%NGINX_DIR%" nginx -s reload goto :eof :: nginx :showVersionNginx echo. %NGINX_PATH% cd "%NGINX_DIR%" nginx -V goto :eof

좋은 웹페이지 즐겨찾기