Skip to content

Instantly share code, notes, and snippets.

@melmi

melmi/dl.sh

Created Oct 10, 2016
Embed
What would you like to do?
#!/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