Files
mtusi2026lab2-fork/scripts/restart.bat
T

12 lines
549 B
Batchfile

@echo off
setlocal
cd /d "%~dp0.."
docker compose --env-file .env restart db
if errorlevel 1 exit /b 1
docker compose --env-file .env restart redis
if errorlevel 1 exit /b 1
docker compose --env-file .env restart api
if errorlevel 1 exit /b 1
powershell -NoProfile -Command "$deadline=(Get-Date).AddSeconds(90); do { try { $r=Invoke-WebRequest -UseBasicParsing http://localhost:8080/health/ready -TimeoutSec 2; if ($r.StatusCode -eq 200) { exit 0 } } catch {}; Start-Sleep -Seconds 2 } while ((Get-Date) -lt $deadline); exit 1"
exit /b %ERRORLEVEL%