Oli*_*Oli 11
Apt 更新由名为/etc/cron.daily/apt. /etc/cron.daily包含每天发生但同时发生的几个脚本。为了更改 Update Manager 更新的时间,您需要更改所有更新的时间/etc/cron.daily脚本触发的时间。
为此,您需要编辑/etc/crontab文件:
sudoedit /etc/crontab # or: gksu gedit /etc/crontab
Run Code Online (Sandbox Code Playgroud)
这是一个相当标准的cron文件,看起来应该像这样:
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
Run Code Online (Sandbox Code Playgroud)
从中我们可以看到cron.daily早上 6 点 25 分的触发器。如果您想在凌晨 4 点开始,您可以将第二行替换为:
0 4 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
Run Code Online (Sandbox Code Playgroud)
如果您需要有关格式的更多帮助,维基百科在 Cron 上有一个异常技术页面。
| 归档时间: |
|
| 查看次数: |
1684 次 |
| 最近记录: |