
大家好,我是論壇的新人,也是 Linux 工具的新手。事實上,我的任務就是學習wget
。我已經知道一些,但我正在嘗試找出是否有語法可用於安排複製或下載的開始和停止時間,請幫助,謝謝!
答案1
wget
本身沒有調度屬性,但是當您使用 Linux 時,您可能需要查看cron
.
Cron 是 Linux 中基於時間的作業排程程序,用於排程作業(指令或 shell 腳本)在固定時間、日期或間隔定期執行。
若要以普通使用者身分將作業新增至 cron 調度程序,請執行下列命令:
crontab -e
否則,如果你想為 root 安排一份工作:
sudo crontab -e
Linux crontab 格式
MIN HOUR DOM MON DOW CMD
Field Description Allowed Value
MIN Minute field 0 to 59
HOUR Hour field 0 to 23
DOM Day of Month 1-31
MON Month field 1-12
DOW Day Of Week 0-6
CMD Command Any command to be executed.
例如:
在特定時間運行 wget 假設在 7 月 15 日上午 8:20
那麼 cron 條目將是這樣的:
20 08 15 07 * wget URL://
看一眼:
man cron
man crontab
man 5 crontab
- http://www.adminschoice.com/crontab-quick-reference
- https://askubuntu.com/a/630124/150504
現在,當您想要停止 wget 時,您還必須使用pkill
命令添加另一個 cron 條目:假設我想在 7 月 15 日晚上 10:30 停止 wget,然後將此條目添加到 cron:
30 22 15 07 * pkill wget
若要再次恢復損壞的wget
下載,您可以使用wget 中的-c
或--continue
選項。
wget -c URL://
wget --continue URL://
man wget
-c
--continue
Continue getting a partially-downloaded file. This is useful when
you want to finish up a download started by a previous instance of
Wget, or by another program.
答案2
通常的 linux/unix 方法是使用另一個系統實用程式來安排 wget 活動:cron。
看
man 5 crontab
man cron
和
man crontab