【问题标题】:Process files while downloading with aria2使用 aria2 下载时处理文件
【发布时间】:2019-08-11 09:50:25
【问题描述】:
我定期从 Internet 将 zip 文件夹下载到特定文件夹,每次下载过程完成时(我使用 aria2 作为下载管理器)我想运行一个特定的 bash 脚本来处理数据。
关于如何进行的任何想法?我找到了几个参考资料,但我不熟悉 bash 脚本。顺便说一句,我正在开发 Ubuntu 16.04。
例如,我有以下文件夹
每次下载完成,我想运行script.sh
【问题讨论】:
标签:
bash
shell
directory
filesystems
monitoring
【解决方案1】:
根据the documentation,aria2 提供了一个名为--on-download-complete 的事件挂钩:
事件挂钩
aria2 提供了选项来指定指定后的任意命令
事件发生。目前有以下选项可用:
--on-bt-download-complete,--on-download-pause,--on-download-complete。 --on-download-start, --on-download-error, --on-download-stop.
所以,如果您已经有script.sh,只需调用 aria 使用
aria2c --on-download-complete script.sh http://example.org/file.iso