forked from mtusi2026/mtusi2026lab4
chore(solution): port lab3 sources
This commit is contained in:
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
ENGINE=${ENGINE:-$(command -v podman >/dev/null 2>&1 && echo podman || echo docker)}
|
||||
PROJECT=${PROJECT:-messenger-lab3}
|
||||
: "${TARGET_INSTANCE_ID:?TARGET_INSTANCE_ID is required}"
|
||||
|
||||
for id in $($ENGINE ps -q --filter "label=com.docker.compose.project=$PROJECT" --filter "label=com.docker.compose.service=api"); do
|
||||
if [ "$($ENGINE inspect -f '{{.Config.Hostname}}' "$id")" = "$TARGET_INSTANCE_ID" ]; then
|
||||
$ENGINE stop -t 10 "$id" >/dev/null
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
exit 1
|
||||
Reference in New Issue
Block a user