14 lines
424 B
Bash
Executable File
14 lines
424 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
: "${TARGET_INSTANCE_ID:?TARGET_INSTANCE_ID is required}"
|
|
cd "$(dirname "$0")/.."
|
|
for container in $(docker compose ps -q api); do
|
|
instance=$(docker exec "$container" cat /run/local/instance 2>/dev/null || true)
|
|
if [ "$instance" = "$TARGET_INSTANCE_ID" ]; then
|
|
docker stop --time 3 "$container" >/dev/null
|
|
exit 0
|
|
fi
|
|
done
|
|
echo "No API container matches the requested process alias" >&2
|
|
exit 1
|