Files
mtusi2026lab3/scripts/stop-one.sh

12 lines
521 B
Bash
Executable File

#!/bin/sh
set -eu
# Explicit failover hook: stop exactly ONE API replica selected by the test.
# TARGET_INSTANCE_ID is the X-Instance-Id served by that replica (api1 or api2).
# DB, volume and load balancer are untouched. Return quickly; leave the replica stopped.
cd "$(dirname "$0")/.."
: "${TARGET_INSTANCE_ID:?test provides target API instance alias}"
case "$TARGET_INSTANCE_ID" in
api1|api2) docker compose stop "$TARGET_INSTANCE_ID" ;;
*) echo "unknown target instance: $TARGET_INSTANCE_ID" >&2; exit 1 ;;
esac