Files
felhom.eu/documentation/audits/release-2b-3-2026-11-15/part3/wait-ctl.sh
T

16 lines
684 B
Bash

#!/bin/bash
# wait-ctl.sh VERSION [MINUTES] — wait until guest 9201 on the three test boxes runs controller VERSION (reads).
V=$1; M=${2:-25}
end=$(( $(date +%s) + M*60 ))
while [ "$(date +%s)" -lt "$end" ]; do
ok=0; line=""
for h in root@192.168.0.154 demo-hp felhom-pve; do
img=$(timeout 20 ssh -o BatchMode=yes -o ConnectTimeout=8 "$h" "pct exec 9201 -- docker ps --filter name=^felhom-controller$ --format '{{.Image}} {{.Status}}'" 2>/dev/null)
line="$line | $h: ${img##*:}"
case "$img" in *":$V "*healthy*) ok=$((ok+1));; esac
done
if [ "$ok" = 3 ]; then echo "$(date +%T) all three$line"; exit 0; fi
sleep 30
done
echo "$(date +%T) TIMEOUT$line"; exit 1