0

我昨天发布了这个superuser,但也许在这里更好。如果我不正确,我深表歉意。

我正在尝试aria2c使用ubuntu 14.04. 基本上下载开始并到达大约 30 分钟,然后出现超时错误。正在下载的文件为 25GB,并且通常使用循环下载多个文件。有什么建议可以使这更有效和稳定吗?目前,每个文件下载大约需要4个小时,只要没有错误是可以的。我也得到了一个aria2c带有部分下载文件的文件。谢谢 :)。

aria2c -x 4 -l log.txt -c -d /home/cmccabe/Desktop/download --http-user "xxxxx"  --http-passwd xxxx xxx://www.example.com/x/x/xxx/"file"

我为这个标签道歉,因为我无法创建一个新的,这是最接近的。

4

1 回答 1

3

您可以编写一个循环来重新运行 aria2c,直到下载所有文件(请参阅此要点)。

基本上,您可以将所有链接放在一个文件中(例如list.txt):

http://foo/file1
http://foo/file2
...

然后运行loop_aria2.sh

#!/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

aria2c -j5 -i list.txt -c --save-session out.txt将并行下载 5 个文件 ( -j5) 并将失败的文件写入out.txt. 如果out.txt不为空 ( $has_error -gt 0),则重新运行相同的命令以继续下载。aria2c的-c选项将跳过已完成的文件。

PS:另一个更简单的解决方案(不检查错误),如果你不介意的话,它只运行 aria2 1000 次 :)

seq 1000 | parallel -j1 aria2c -i list.txt -c 
于 2016-09-24T10:23:40.263 回答