gates / gates (push) Successful in 2m9s
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
11 lines
492 B
Bash
11 lines
492 B
Bash
#!/bin/bash
|
|
# wait-agent.sh SSH_TARGET VERSION [MINUTES] — wait until the box's agent says VERSION (a read each 30 s).
|
|
T=$1; V=$2; M=${3:-22}
|
|
end=$(( $(date +%s) + M*60 ))
|
|
while [ "$(date +%s)" -lt "$end" ]; do
|
|
cur=$(timeout 15 ssh -o BatchMode=yes -o ConnectTimeout=8 "$T" 'felhom-agent --version' 2>/dev/null | awk '{print $2}')
|
|
if [ "$cur" = "$V" ]; then echo "$(date +%T) $T agent $cur"; exit 0; fi
|
|
sleep 30
|
|
done
|
|
echo "$(date +%T) $T TIMEOUT, agent is ${cur:-unreadable}"; exit 1
|