13 lines
456 B
Bash
Executable File
13 lines
456 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
: "${TARGET_INSTANCE_ID:?TARGET_INSTANCE_ID required}"
|
|
for container in $(./scripts/compose.sh ps -q api); do
|
|
instance=$(docker exec "$container" python -c 'import urllib.request; print(urllib.request.urlopen("http://127.0.0.1:8080/health/live").headers["X-Instance-Id"])')
|
|
if [ "$instance" = "$TARGET_INSTANCE_ID" ]; then
|
|
docker stop -t 2 "$container" >/dev/null
|
|
exit 0
|
|
fi
|
|
done
|
|
exit 1
|