Files
mtusi2026lab5/scripts/stop_one.sh
T
2026-11-20 13:05:30 +03:00

13 lines
482 B
Bash

#!/bin/sh
set -eu
: "${TARGET_INSTANCE_ID:?test provides target API instance alias}"
if [ "$TARGET_INSTANCE_ID" != "api-1" ] && [ "$TARGET_INSTANCE_ID" != "api-2" ]; then
echo "Unknown instance: $TARGET_INSTANCE_ID" >&2
exit 1
fi
SERVICE_NAME="$TARGET_INSTANCE_ID"
if [ "$SERVICE_NAME" = "api-1" ]; then SERVICE_NAME="api1"; fi
if [ "$SERVICE_NAME" = "api-2" ]; then SERVICE_NAME="api2"; fi
echo "Stopping container for $SERVICE_NAME..."
docker compose stop "$SERVICE_NAME"