Реализовать ЛР 7 на оценку 3

This commit is contained in:
2026-12-04 14:27:18 +03:00
parent 31d441184b
commit 7996ebbb48
59 changed files with 2236 additions and 498 deletions
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
: "${TARGET_INSTANCE_ID:?Set TARGET_INSTANCE_ID to the API replica alias}"
containers=$(docker compose --env-file "${COMPOSE_ENV_FILE:-.env}" ps -q api)
for container in $containers; do
if [ "$(docker exec "$container" cat /tmp/lab-instance-id)" = "$TARGET_INSTANCE_ID" ]; then
docker stop -t 3 "$container"
exit 0
fi
done
echo "API replica $TARGET_INSTANCE_ID is not running in this project" >&2
exit 1