Перенесла файлы проекта из предыдущей лабораторной работы

This commit is contained in:
vasyukova
2026-11-04 22:30:42 +03:00
parent 20afc2c790
commit e9a7a7e793
70 changed files with 8588 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
#!/bin/sh
set -eu
: "${TARGET_INSTANCE_ID:?test provides target API instance alias}"
TARGET=""
for c in $(docker ps --filter "label=com.docker.compose.service=api" -q); do
id=$(docker exec "$c" cat /tmp/instance_id 2>/dev/null || true)
if [ "$id" = "$TARGET_INSTANCE_ID" ]; then
TARGET="$c"
break
fi
done
if [ -z "$TARGET" ]; then
echo "no api replica with INSTANCE_ID=$TARGET_INSTANCE_ID" >&2
exit 1
fi
docker stop -t 3 "$TARGET" >/dev/null
i=0
while [ $i -lt 50 ]; do
if ! docker ps --filter "id=$TARGET" --format "{{.ID}}" | grep -q .; then
exit 0
fi
i=$((i+1)); sleep 0.1
done
exit 0