nginx.bat 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. @echo off
  2. rem zheng-tools
  3. rem author: shuzheng http://www.zhangshuzheng.cn
  4. rem GitHub: https://github.com/shuzheng
  5. rem OsChina: http://git.oschina.net/shuzheng/zheng
  6. echo ==================begin========================
  7. cls
  8. SET NGINX_PATH=D:
  9. SET NGINX_DIR=D:\nginx-1.11.11\
  10. color 0a
  11. TITLE zheng-tools Power By shuzheng (http://www.zhangshuzheng.cn)
  12. CLS
  13. ECHO.
  14. ECHO. ********************************************************************
  15. ECHO. * *
  16. ECHO. * *
  17. ECHO. * zheng-tools Power By shuzheng (http://www.zhangshuzheng.cn) *
  18. ECHO. * *
  19. ECHO. * *
  20. ECHO. ********************************************************************
  21. ECHO.
  22. :MENU
  23. ECHO.---------------------------- nginx 进程列表 --------------------------------
  24. tasklist|findstr /i "nginx.exe"
  25. if ERRORLEVEL 1 (echo nginx未启动) else (echo nginx已启动)
  26. ECHO.----------------------------------------------------------------------------
  27. ECHO.
  28. ECHO. [1] 启动Nginx
  29. ECHO. [2] 关闭Nginx
  30. ECHO. [3] 重启Nginx
  31. ECHO. [4] 退 出
  32. ECHO.
  33. ECHO.请输入选择项目的序号:
  34. set /p ID=
  35. IF "%id%"=="1" GOTO start
  36. IF "%id%"=="2" GOTO stop
  37. IF "%id%"=="3" GOTO restart
  38. IF "%id%"=="4" EXIT
  39. PAUSE
  40. :start
  41. call :startNginx
  42. ECHO.============================================================================
  43. ECHO.
  44. ECHO.
  45. GOTO MENU
  46. :stop
  47. call :shutdownNginx
  48. ECHO.============================================================================
  49. ECHO.
  50. ECHO.
  51. GOTO MENU
  52. :restart
  53. call :shutdownNginx
  54. call :startNginx
  55. ECHO.============================================================================
  56. ECHO.
  57. ECHO.
  58. GOTO MENU
  59. :shutdownNginx
  60. ECHO.
  61. ECHO.关闭Nginx......
  62. taskkill /F /IM nginx.exe > nul
  63. ECHO.OK,关闭所有nginx 进程
  64. goto :eof
  65. :startNginx
  66. ECHO.
  67. ECHO.启动Nginx......
  68. IF NOT EXIST "%NGINX_DIR%nginx.exe" ECHO "%NGINX_DIR%nginx.exe"不存在
  69. %NGINX_PATH%
  70. cd "%NGINX_DIR%"
  71. IF EXIST "%NGINX_DIR%nginx.exe" (
  72. echo "start '' nginx.exe"
  73. start "" nginx.exe
  74. )
  75. ECHO.OK
  76. goto :eof