#!/bin/bash cd /home/dima/jung D=downloads/08-developmental LOG=$D/en-queue.log echo "=== EN queue start $(date)" >> "$LOG" while read -r f_id ed_id name; do [ -z "$f_id" ] && continue if ls "$D/$name"*.pdf "$D/$name"*.epub "$D/$name"*.fb2 "$D/$name"*.doc "$D/$name"*.rtf >/dev/null 2>&1; then echo "SKIP (exists): $name" >> "$LOG" continue fi rm -f "$D/$name"*.part echo "=== $name (f/$f_id) $(date)" >> "$LOG" timeout 1500 python3 -u -c " import sys; sys.path.insert(0,'tools'); import lgdl r = lgdl.download(sys.argv[1], sys.argv[2], sys.argv[3], tries=3) sys.exit(0 if r else 1)" "$f_id" "$D" "$name" >> "$LOG" 2>&1 rc=$? echo "rc=$rc $name" >> "$LOG" sleep 2 done < "$D/en-queue.txt" echo "=== EN queue round DONE $(date)" >> "$LOG"