20 lines
731 B
Batchfile
20 lines
731 B
Batchfile
@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
|