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

11 lines
562 B
Bash

#!/bin/bash
# wait-bundle.sh SSH_TARGET VERSION [MINUTES] — wait until the box's journal says the config bundle VERSION is installed.
T=$1; V=$2; M=${3:-22}
end=$(( $(date +%s) + M*60 ))
while [ "$(date +%s)" -lt "$end" ]; do
n=$(timeout 20 ssh -o BatchMode=yes -o ConnectTimeout=8 "$T" "journalctl -u felhom-agent --since '-60min' --no-pager | grep 'config bundle INSTALLED' | grep -c 'agent_version=$V'" 2>/dev/null)
if [ "${n:-0}" -ge 1 ]; then echo "$(date +%T) $T bundle $V installed"; exit 0; fi
sleep 30
done
echo "$(date +%T) $T TIMEOUT"; exit 1