Skip to content

Instantly share code, notes, and snippets.

@jonbakerfish
Last active February 27, 2023 06:45
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save jonbakerfish/0f7877c050b648169e0958ea2e2c6aca to your computer and use it in GitHub Desktop.
Save jonbakerfish/0f7877c050b648169e0958ea2e2c6aca to your computer and use it in GitHub Desktop.
aria2 downloads a list of files, loop until all file are finished
#!/bin/bash
aria2c -j5 -i list.txt -c --save-session out.txt
has_error=`wc -l < out.txt`
while [ $has_error -gt 0 ]
do
echo "still has $has_error errors, rerun aria2 to download ..."
aria2c -j5 -i list.txt -c --save-session out.txt
has_error=`wc -l < out.txt`
sleep 10
done
### PS: one line solution, just loop 1000 times
### seq 1000 | parallel -j1 aria2c -i list.txt -c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment