#!/usr/bin/env bash # Independent progress watcher for the pl_hi reforecast download. # Logs count every 5 min; writes logs/pl_hi.DONE and exits when 104 reached. set -u cd "$(dirname "$0")/.." || exit 1 DIR=data/raw/ecmwf_s2s_1p5deg LOG=logs/pl_hi_monitor.log TARGET=104 mkdir -p logs while true; do n=$(ls "$DIR" 2>/dev/null | grep -c s2s_cf_pl_hi_ls) dl=$(pgrep -f "05_download_reforecasts.py.*pl_hi" >/dev/null && echo "running" || echo "STOPPED") echo "$(date '+%Y-%m-%d %H:%M:%S') pl_hi=$n/$TARGET downloader=$dl" >> "$LOG" if [ "$n" -ge "$TARGET" ]; then echo "$(date '+%Y-%m-%d %H:%M:%S') COMPLETE: $n/$TARGET" | tee -a "$LOG" > logs/pl_hi.DONE break fi sleep 300 done