jung/tools/lgdl-rounds.sh

20 lines
811 B
Bash
Executable file

#!/bin/bash
# Cooldown-round runner for lgdl-queue.sh (ads.php throttle: 25-min pauses between rounds).
# Usage: tools/lgdl-rounds.sh <section-dir> <queue-file> [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"