You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
@echo off chcp 65001 > nul
setlocal
set PORT=8089
::echo 正在检查端口 %PORT% 是否可用...
:loop netstat -ano | findstr ":%PORT%" >nul if "%errorlevel%"=="0" ( echo 端口 %PORT% 已启动,开始启动Nginx服务... goto check_nginx ) else (
timeout /t 5 >nul goto loop )
:check_nginx
tasklist /FI "IMAGENAME eq nginx.exe" | find /I /N "nginx.exe" >NUL if "%ERRORLEVEL%"=="0" ( echo Nginx服务已经在运行,重新加载Nginx配置... cd ./nginx nginx.exe -s reload ) else ( echo Nginx服务正在启动,请稍等... cd ./nginx start nginx.exe timeout /t 5 /nobreak > nul )
echo 检查Nginx服务是否已经启动成功... tasklist /FI "IMAGENAME eq nginx.exe" | find /I /N "nginx.exe" >NUL if "%ERRORLEVEL%"=="0" ( echo Nginx服务已经成功启动。 goto successful_actions ) else ( echo 服务启动失败,正在重新尝试... goto check_nginx )
endlocal
:successful_actions echo 所有服务启动成功...
echo 准备打开程序...
:: start http://localhost:80 :: start http://192.168.3.20:8083
:: 启动程序 call start_program.bat
:: 调用同级目录下的脚本文件创建快捷方式到桌面 cd.. call copy__shortcut.bat
:: 暂停,等待用户按下任意键 :: pause
exit
|