我住在一个偏远地区,我的互联网是以卫星为基础的。数据是昂贵的,而且是有限的,不过一夜之间就不计较,而且数据移动得更快。如何安排软件更新程序在夜间执行更新?我见过很多类似的问题,但没有答案。有一个简单到中等技术水平的脚本可以写吗?
发布于 2020-02-26 03:04:57
的系统定时器
有三个设置需要更改:
/lib/systemd/system/apt-daily.timer这提供了您的日常apt更新,刷新包数据库。更改本节:
[Timer]
OnCalendar=*-*-* 6,18:00 // Try *-*-* 02:17 for nightly at 0217 (2:17 am)
RandomizedDelaySec=12h // Comment out this line (prepend with a '#') - you don't want random delay
Persistent=true // Keep this line/lib/systemd/system/apt-daily-upgrade.timer这提供了您每天无人值守的升级,安装安全升级。之前的作业必须先运行--计算升级需要读取包数据库。更改本节:
[Timer]
OnCalendar=*-*-* 06:00 // Try *-*-* 03:17 for nightly at 0317 (3:17 am)
RandomizedDelaySec=60m // Comment out this line (prepend with a '#') - you don't want random delay
Persistent=true // Keep this line/etc/cron.daily/apt-compat这项工作增加了apt的额外随机性。这样做的目的是通过在时间上随机分配作业来避免镜像超载。您完成了这个目标的精神,将其他适当的任务设置为一个不寻常的时间(就像一小时后17分钟),.Change本节:
# delay the job execution by a random amount of time
random_sleep // Comment out this line by adding a '#' in front.https://askubuntu.com/questions/1213053
复制相似问题