forked from mtusi2026/mtusi2026lab5
Complete Lab 5 grade 4 async attachment pipeline
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
: "${TARGET_INSTANCE_ID:?TARGET_INSTANCE_ID is required}"
|
||||
|
||||
for container_id in $(docker compose ps -q api); do
|
||||
hostname=$(docker inspect --format '{{.Config.Hostname}}' "$container_id")
|
||||
if [[ "$hostname" == "$TARGET_INSTANCE_ID" ]]; then
|
||||
mkdir -p evidence
|
||||
printf '%s %s\n' "$(date -u +%FT%TZ)" "$TARGET_INSTANCE_ID" >> evidence/stopped-replicas.txt
|
||||
docker stop --time 6 "$container_id" >/dev/null
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
printf 'No running API container matches TARGET_INSTANCE_ID.\n' >&2
|
||||
exit 1
|
||||
Reference in New Issue
Block a user