forked from mtusi2026/mtusi2026lab5
ЛР 5 — БПИ2302 — Щербацевич — на 4
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
target="${TARGET_INSTANCE_ID:?test provides target API instance alias}"
|
||||
found=""
|
||||
for id in $(docker ps -q --filter label=com.docker.compose.service=api --filter label=com.docker.compose.project=mtusi-lab5); do
|
||||
host=$(docker inspect -f '{{.Config.Hostname}}' "$id")
|
||||
short=$(printf '%s' "$id" | cut -c1-12)
|
||||
if [ "$host" = "$target" ] || [ "$short" = "$target" ] || [ "$id" = "$target" ]; then
|
||||
found=$id
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "$found" ]; then
|
||||
echo "api replica not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
docker stop -t 5 "$found" >/dev/null
|
||||
Reference in New Issue
Block a user