Files
mtusi2026lab5/scripts/restart-stack.bat
2026-11-10 13:55:56 +03:00

27 lines
583 B
Batchfile

@echo off
setlocal EnableDelayedExpansion
cd /d "%~dp0.."
set TMP=%TEMP%\lab5-restart
if not exist "%TMP%" mkdir "%TMP%"
echo === Restarting stack without removing volumes ===
docker compose --compatibility restart
echo === Waiting for /health/ready ===
set COUNT=0
:wait
set /a COUNT+=1
if %COUNT% GTR 90 (
echo FAIL: stack did not become ready in 90s
exit /b 1
)
curl.exe -s -o nul -w "%%{http_code}" http://localhost:8080/health/ready > "%TMP%\code.txt"
set /p C=<"%TMP%\code.txt"
if "%C%"=="200" (
echo Stack is ready.
exit /b 0
)
timeout /t 1 /nobreak >nul
goto wait