4_grade
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
: "${TARGET_INSTANCE_ID:?}"
|
||||
|
||||
for svc in api1 api2; do
|
||||
if ! docker compose ps "$svc" 2>/dev/null | grep -q "Up"; then
|
||||
continue
|
||||
fi
|
||||
instance=$(docker compose exec -T "$svc" sh -c 'echo $INSTANCE_ID' 2>/dev/null || true)
|
||||
if [ "$instance" = "$TARGET_INSTANCE_ID" ]; then
|
||||
docker compose stop "$svc"
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Instance $TARGET_INSTANCE_ID not found" >&2
|
||||
exit 1
|
||||
Reference in New Issue
Block a user