Files
mtusi2026lab3-fork/scripts/stop-one.sh
T
2026-10-20 18:35:44 +03:00

15 lines
579 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/sh
set -eu
# TARGET_INSTANCE_ID приходит от теста: alias обслужившей реплики.
# В compose alias = INSTANCE_ID = "api-1" / "api-2".
: "${TARGET_INSTANCE_ID:?test provides target API instance alias}"
case "$TARGET_INSTANCE_ID" in
api-1) SERVICE=api1 ;;
api-2) SERVICE=api2 ;;
*) echo "unknown instance: $TARGET_INSTANCE_ID" >&2; exit 2 ;;
esac
# Останавливаем ТОЛЬКО эту реплику, оставляем остановленной.
docker compose stop "$SERVICE"
echo "stopped $SERVICE ($TARGET_INSTANCE_ID)"