Skip to content

Instantly share code, notes, and snippets.

@melmi
Created October 10, 2016 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melmi/bc96a16b77238702a3a534fe3927dd31 to your computer and use it in GitHub Desktop.
Save melmi/bc96a16b77238702a3a534fe3927dd31 to your computer and use it in GitHub Desktop.
#!/bin/bash
cd ~/Downloads/auto/
echo "============================" >> log.txt
echo "[$(date)] script launched" >> log.txt
echo "[$(date)] renewing dllist.txt" >> log.txt
rm dllist.txt
wget --user=folani --password=passwordesh melmi.ir/downloads/dllist.txt
echo "[$(date)] creating active.txt" >> log.txt
comm dllist.txt done.txt -23 --nocheck-order > active.txt
while [ -s active.txt ]
do
echo "[$(date)] starting download" >> log.txt
head -n 1 active.txt >> log.txt
head -n 1 active.txt | sed -e's/%\([0-9A-F][0-9A-F]\)/\\\\\x\1/g' | xargs echo -e | xargs -I {} wget -c "{}"
echo "[$(date)] finished" >> log.txt
head -n 1 active.txt >> done.txt
tail -n +2 active.txt > tmp.txt
mv tmp.txt active.txt
done
echo "[$(date)] script finished." >> log.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment