我有一个脚本可以读取一些网址并让他们到axel下载它们。我希望有时停止脚本并进一步恢复。 Axel可以恢复文件下载。因此,如果我在下载时按Ctrl + C,则下次从文件的恢复开始。
但是axel没有检查文件是否存在。因此,它将“.0”附加到文件名的末尾,并开始将其下载两次。我怎么能告诉axel是否存在同名文件,跳过它并且不下载它?
答案 0 :(得分:9)
如果你想恢复axel,你应该使用
axel -o NAME_OF_EXISTING_FILE
如果要检查文件是否存在
if [ -f $FILE ];
then
echo "File $FILE exists." #operation related to when file exists
else
echo "File $FILE does not exist." #operation related to when file does not exists
fi
或者
if [ ! -f /tmp/foo.txt ];
then
echo "File not found!" #operation related to when file does not exists
fi
来自here
的Bash脚本答案 1 :(得分:4)
Axel使用以.st扩展名命名的状态文件 它会在下载过程中定期更新 当axel启动时,它首先检查< file>和< file.st>。如果找到,下载将在停止的地方恢复 你有哪个版本?我得到了Axel版本2.4(Linux),它在CTRL + C后正确恢复。