forked from mtusi2026/mtusi2026lab4
ЛР 4 - БПИ2302 - Щербацевич - на 4
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
@echo off
|
||||
setlocal EnableDelayedExpansion
|
||||
cd /d "%~dp0.."
|
||||
if "%TARGET_INSTANCE_ID%"=="" (
|
||||
echo TARGET_INSTANCE_ID is required >&2
|
||||
exit /b 1
|
||||
)
|
||||
for /f "usebackq delims=" %%I in (`docker compose --env-file .env ps -q api`) do (
|
||||
for /f "usebackq delims=" %%H in (`docker inspect -f "{{.Config.Hostname}}" %%I`) do (
|
||||
if "%%H"=="%TARGET_INSTANCE_ID%" (
|
||||
docker stop %%I >nul
|
||||
exit /b 0
|
||||
)
|
||||
)
|
||||
if "%%I"=="%TARGET_INSTANCE_ID%" (
|
||||
docker stop %%I >nul
|
||||
exit /b 0
|
||||
)
|
||||
)
|
||||
echo no api replica matched TARGET_INSTANCE_ID >&2
|
||||
exit /b 1
|
||||
Reference in New Issue
Block a user