#!/bin/bash # Cooldown-round runner for lgdl-queue.sh (ads.php throttle: 25-min pauses between rounds). # Usage: tools/lgdl-rounds.sh [max_rounds] cd /home/dima/jung D="$1"; Q="$2"; MAX="${3:-6}"; RLOG="$D/rounds.log" n=1 while [ "$n" -le "$MAX" ]; do echo "=== ROUND $n $(date)" >> "$RLOG" bash tools/lgdl-queue.sh "$D" "$Q" remaining=0 while read -r f_id ed_id name; do [ -z "$f_id" ] && continue ls "$D/$name"*.pdf "$D/$name"*.epub "$D/$name"*.fb2 "$D/$name"*.doc "$D/$name"*.rtf "$D/$name"*.djvu >/dev/null 2>&1 || remaining=$((remaining+1)) done < "$Q" echo "round $n done, remaining=$remaining $(date)" >> "$RLOG" [ "$remaining" -eq 0 ] && { echo "ALL DONE" >> "$RLOG"; break; } sleep 1500 n=$((n+1)) done echo "=== ROUNDS COMPLETE $(date)" >> "$RLOG"