forked from mtusi2026/mtusi2026lab5
chore(migrate) moved codebase from lab4
This commit is contained in:
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
: "${TARGET_INSTANCE_ID:?test provides target API instance alias}"
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
target=""
|
||||
for id in $(docker compose --env-file .env ps -q api); do
|
||||
hostname=$(docker inspect -f '{{.Config.Hostname}}' "$id")
|
||||
if [ "$hostname" = "$TARGET_INSTANCE_ID" ]; then
|
||||
target="$id"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$target" ]; then
|
||||
echo "no running API replica has instance id $TARGET_INSTANCE_ID" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
docker stop --time 5 "$target" >/dev/null
|
||||
Reference in New Issue
Block a user