ЛР3 - БПИ2303 - Стругов - на 4

This commit is contained in:
wanderinho
2026-11-10 15:19:31 +03:00
parent 0ab3a341aa
commit bdccb3ad7d
33 changed files with 3591 additions and 23 deletions
+14
View File
@@ -0,0 +1,14 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
: "${TARGET_INSTANCE_ID:?test provides instance alias}"
# Default Docker hostname is the container's short ID, used as X-Instance-Id.
for id in $(docker compose ps -q api); do
hostname=$(docker inspect --format '{{.Config.Hostname}}' "$id")
if [ "$hostname" = "$TARGET_INSTANCE_ID" ]; then
docker stop --time 2 "$id" >/dev/null
exit 0
fi
done
printf '%s\n' 'No running API container matches TARGET_INSTANCE_ID' >&2
exit 1