#!/bin/bash # watch.sh — on DooPlex, 2026-10-27 from ~09:45 CET: sample every 60 s; stop 20 min after the agent's # measurement AND the controller's „limit is back" line, or at 16:05 CET. Reads only; forces nothing. E=$1; since=$(date -u +%Y-%m-%dT%H:%M:%SZ); done_at="" while true; do ssh -o ConnectTimeout=20 demo-hp "pct exec 9201 -- sh /root/r1250/gsample.sh" >> $E/samples.txt 2>&1 ssh -o ConnectTimeout=20 demo-hp "journalctl -u felhom-agent --since '$since' --no-pager | grep -iE 'linetest'" > $E/agent-linetest.txt 2>&1 ssh -o ConnectTimeout=20 demo-hp "pct exec 9201 -- sh -c 'docker logs --since $since felhom-controller 2>&1 | grep -iE \"upwatch|line test|qbittorrent.*limit\" | grep -v DEBUG'" > $E/controller-upwatch.txt 2>&1 if [ -z "$done_at" ] && grep -q "upload line measured" $E/agent-linetest.txt && grep -q "limit is back" $E/controller-upwatch.txt; then done_at=$(date +%s); echo "$(date -u +%T) TEST DONE — 20 more minutes for the 50 % rule's tick" >> $E/samples.txt fi [ -n "$done_at" ] && [ $(( $(date +%s) - done_at )) -ge 1200 ] && { echo "$(date -u +%T) watch end (done)" >> $E/samples.txt; exit 0; } [ "$(TZ=Europe/Budapest date +%H%M)" -ge 1605 ] && { echo "$(date -u +%T) watch end (16:05 CET)" >> $E/samples.txt; exit 0; } sleep 60 done