completed lab4

This commit is contained in:
2026-11-06 17:03:03 +03:00
parent ec540a1a72
commit 6b42473aec
30 changed files with 1184 additions and 39 deletions
+16
View File
@@ -0,0 +1,16 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
: "${TARGET_INSTANCE_ID:?Set TARGET_INSTANCE_ID from a real API response}"
for id in $(docker compose ps -q api); do
host=$(docker inspect -f '{{.Config.Hostname}}' "$id")
case "$TARGET_INSTANCE_ID" in
"$host"-*)
printf 'Stopping API container %s (hostname %s)\n' "$id" "$host"
docker stop --time 5 "$id"
docker inspect -f '{{.Id}} {{.State.Status}}' "$id"
exit 0;;
esac
done
printf 'No running API matches target\n' >&2
exit 1