#!/bin/bash cd /home/dima/jung D=downloads/08-developmental for round in 1 2 3 4 5 6; do echo "=== ROUND $round $(date)" >> "$D/en-rounds.log" bash "$D/en-queue.sh" 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 >/dev/null 2>&1 || remaining=$((remaining+1)) done < "$D/en-queue.txt" echo "round $round done, remaining=$remaining $(date)" >> "$D/en-rounds.log" if [ "$remaining" -eq 0 ]; then echo "ALL DONE" >> "$D/en-rounds.log" break fi echo "cooldown 25 min" >> "$D/en-rounds.log" sleep 1500 done echo "=== ROUNDS COMPLETE $(date)" >> "$D/en-rounds.log"