#!/usr/bin/env bash # Poll Jupiter until /tmp/task_variance.out is non-empty, then copy it next to this script. OUT=$(dirname "$0")/task_variance_raw.json for i in $(seq 1 120); do if ssh Jupiter 'test -s /tmp/task_variance.out' 2>/dev/null; then ssh Jupiter 'cat /tmp/task_variance.out' > "$OUT" && echo "$(date -u +%FT%TZ) fetched $(wc -c < "$OUT") bytes" && exit 0 fi sleep 120 done echo "timeout"; exit 2