Files
mtusi2026lab5/scripts/stop-one.sh
T

13 lines
337 B
Bash
Executable File

#!/bin/sh
set -eu
ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
[ -n "${TARGET_INSTANCE_ID:-}" ] || exit 2
for id in $("$ROOT/scripts/compose.sh" ps -q api); do
host=$(docker inspect --format '{{.Config.Hostname}}' "$id")
if [ "$host" = "$TARGET_INSTANCE_ID" ]; then
docker stop --time 8 "$id"
exit 0
fi
done
exit 3