forked from mtusi2026/mtusi2026lab4
ЛР 4 — БВТ2304 — Черников — на 4
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
@echo off
|
||||
rem Windows twin of scripts/stop-one.sh: tests/resilience.py starts the hook directly,
|
||||
rem and Windows cannot execute a .sh file. Stops ONE api replica by X-Instance-Id (container ID).
|
||||
setlocal
|
||||
if "%TARGET_INSTANCE_ID%"=="" (
|
||||
echo TARGET_INSTANCE_ID is not set 1>&2
|
||||
exit /b 2
|
||||
)
|
||||
cd /d "%~dp0.."
|
||||
set PROJECT=%COMPOSE_PROJECT_NAME%
|
||||
if "%PROJECT%"=="" set PROJECT=mtusi-lab4
|
||||
set ID=
|
||||
for /f %%i in ('docker ps -q --filter "id=%TARGET_INSTANCE_ID%" --filter "label=com.docker.compose.project=%PROJECT%" --filter "label=com.docker.compose.service=api"') do set ID=%%i
|
||||
if "%ID%"=="" (
|
||||
echo TARGET_INSTANCE_ID is not a running api replica of %PROJECT% 1>&2
|
||||
exit /b 1
|
||||
)
|
||||
docker stop %ID% >nul || exit /b 1
|
||||
exit /b 0
|
||||
Reference in New Issue
Block a user