nginx 相关

最近开始折腾nginx,windows下面太蛋疼。总结一下

启动(必须去nginx目录下):start nginx
停止:nginx -s stop
关闭进程:taskkill /F /IM nginx.exe > nul   这句很重要,有时候必须用它来杀进程


编写一个简单的批处理来管理这些事情

@echo off
:server_panel
cls
color 0C
echo =============== Choose the server ==============
echo ==            start : start nginx             ==
echo ==            exit : exit panel               ==
echo ================================================

set /p t=Server_name:

if "%t%"=="exit" exit
if "%t%"=="start" goto start_nginx


:start_nginx
cd /d D:\work\demo\node\nginx\nginx-1.6.2
start "" start nginx 
goto nginx_panel

:nginx_panel
cls
::echo =========== *Nginx Server Task List* ===========
::tasklist|findstr /i "nginx.exe"
echo.
echo ============ What do you want to do ============
echo ==          exit : exit panel                 ==
echo ==          stop : stop nginx                 ==
echo ==          restart : restart nginx           ==
echo ==          show : show nginx task list       ==
echo ================================================
set /p ope=I want:   

if "%ope%" == "exit" exit
if "%ope%" == "stop" (taskkill /F /IM nginx.exe > nul) && goto server_panel
if "%ope%" == "start" goto start_nginx
if "%ope%" == "restart" (taskkill /F /IM nginx.exe > nul) && goto start_nginx
if "%ope%" == "show" goto show_nginx_list
goto nginx_panel

:show_nginx_list
echo =========== *Nginx Server Task List* ===========
tasklist|findstr /i "nginx.exe"
pause
goto nginx_panel


你可能感兴趣的:(其它技术,批处理,nginx)