feat:lab3-catchup

This commit is contained in:
Оля Мороз
2026-11-02 12:35:30 +03:00
parent ec540a1a72
commit 185f092f7a
25 changed files with 2011 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
#!/bin/sh
set -eu
: "${TARGET_INSTANCE_ID:?test provides target API instance alias}"
# Находим ID контейнера, чьё имя (HOSTNAME) совпадает с TARGET_INSTANCE_ID.
CID=$(docker compose ps -q api | while read -r id; do
name=$(docker inspect --format '{{.Config.Hostname}}' "$id")
if [ "$name" = "$TARGET_INSTANCE_ID" ]; then
echo "$id"
break
fi
done)
if [ -z "$CID" ]; then
echo "container with hostname $TARGET_INSTANCE_ID not found" >&2
exit 2
fi
docker stop "$CID"
echo "stopped $CID ($TARGET_INSTANCE_ID)"