bab*_*ak6 6 download resume-download
我有一个脚本,读取一些网址,让他们到axel下载它们.我希望有时停止脚本并进一步恢复.Axel可以恢复文件下载.因此,如果我在下载时按Ctrl + C,则下次从文件的恢复开始.
但是axel没有检查文件是否存在.因此,它将".0"附加到文件名的末尾,并开始将其下载两次.我怎么能告诉axel是否存在同名文件,跳过它并且不下载它?
如果你想恢复axel,你应该使用
axel -o NAME_OF_EXISTING_FILE
Run Code Online (Sandbox Code Playgroud)
如果要检查文件是否存在
if [ -f $FILE ]; then
echo "File $FILE exists."
# operation related to when file exists, aka skip download
else
echo "File $FILE does not exist."
# operation related to when file does not exists
fi
Run Code Online (Sandbox Code Playgroud)
要么
function custom_axel() {
local file_thingy="$1"
local url="$2"
if [ ! -e "$file_thingy" ]; then
echo "file not found, downloading: $file_thingy"
axel -avn8 "$url" -o "$file_thingy"
elif [ -e "${file_thingy}.st" ]; then
echo "found partial downloaf, resuming: $file_thingy"
axel -avn8 "$url" -o "$file_thingy"
else
echo "alteady have the file, skipped: $file_thingy"
fi
}
Run Code Online (Sandbox Code Playgroud)
Bash脚本来自这里
Axel 使用状态文件,以 .st 扩展名命名。
下载期间会定期更新。
当 axel 启动时,它首先检查 <file> 和 <file.st>。如果找到,下载将从停止处继续。
你有哪个版本?我得到了 Axel 版本 2.4 (Linux),并且在 CTRL+C 后它可以正确恢复。
| 归档时间: |
|
| 查看次数: |
5305 次 |
| 最近记录: |