use*_*854 22 cron debian unattended-upgrades
我想知道谁在我的 debian-jessie 中开始无人值守升级:
我的手册页
DESCRIPTION
This program can download and install security upgrades automatically
and unattended, taking care to only install packages from the config?
ured APT source, and checking for dpkg prompts about configuration file
changes. All output is logged to /var/log/unattended-upgrades.log.
This script is the backend for the APT::Periodic::Unattended-Upgrade
option and designed to be run from cron (e.g. via /etc/cron.daily/apt).
Run Code Online (Sandbox Code Playgroud)但是我的 crontab 没有通过 crontab 命令显示任何内容:
@stefano:/etc/cron.daily$ crontab -l
no crontab for stefano
# crontab -l
no crontab for root
Run Code Online (Sandbox Code Playgroud)但是我的无人值守升级工作正常!(我的无人值守升级日志文件):
2017-02-05 12:42:42,835 INFO Initial blacklisted packages:
2017-02-05 12:42:42,866 INFO Initial whitelisted packages:
2017-02-05 12:42:42,868 INFO Starting unattended upgrades script
2017-02-05 12:42:42,870 INFO Allowed origins are: ['o=Debian,n=jessie', 'o=Debian,n=jessie-updates', 'o=Debian,n=jessie-backports', 'origin=Debian,codename=jessie,label=Debian-Security']
2017-02-05 12:43:15,848 INFO No packages found that can be upgraded unattended
Run Code Online (Sandbox Code Playgroud)如果我想更改我的日程安排,我必须在哪里检查/修改?
Pet*_*wee 17
对于 Debian 9 (stretch) 和 Debian 10 (buster),无人值守升级的时间表分两步确定:
其中一个中的较低频率会阻碍另一个中的较高频率,因此请确保两个步骤的设置都正确。
该过程由以下两个 systemd 计时器启动:
apt-daily.timer
更新包列表 ( apt-get update
),和apt-daily-upgrade.timer
安装升级 ( unattended-upgrade
)。( anacron 作业/etc/cron.daily/apt-compat
仍然存在,但如果它检测到 systemd 就会退出。如果您不使用 systemd,请参阅其他答案或 anacron 文档以了解有关更改计划的信息。)
要修改更新计划:
$ sudo systemctl edit apt-daily.timer
Run Code Online (Sandbox Code Playgroud)
这创造了/etc/systemd/system/apt-daily.timer.d/override.conf
. 填写如下,例如:
[Timer]
OnCalendar=
OnCalendar=01:00
RandomizedDelaySec=15m
Run Code Online (Sandbox Code Playgroud)
升级时间表相同:
$ sudo systemctl edit apt-daily-upgrade.timer
[Timer]
OnCalendar=
OnCalendar=01:30
RandomizedDelaySec=0
Run Code Online (Sandbox Code Playgroud)
检查您的工作:
$ systemctl cat apt-daily{,-upgrade}.timer
$ systemctl --all list-timers apt-daily{,-upgrade}.timer
Run Code Online (Sandbox Code Playgroud)
(部分摘自Debian Wiki: UnattendedUpgrades。)
无论您使用 systemd 计时器还是 anacron 作业作为系统调度程序,最终都会调用相同的脚本。该脚本根据 APT::Periodic 中设置的间隔对是否需要再次运行做出新的第二次决定。您通常应该在/etc/apt/apt.conf.d/20auto-upgrades
以下位置找到这些设置:
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
Run Code Online (Sandbox Code Playgroud)
我一直认为"1"
这里的值只是表示 True 或 On,但实际上,它是运行之间的最小间隔,以天数表示。如果脚本确定自上次执行请求的操作以来已经过去了更少的时间,它就不会执行该操作,而不管系统调度程序调用它的事实。
对于 1.5 以上的 apt 版本(Debian 10 buster),您可以将 APT::Periodic 值从 更改"1"
为"always"
。您只需执行一次此操作,从那时起,您只需与系统调度程序(systemd timer 或 anacron)交互即可更改调度。
有关上述内容的更多详细信息,或者如果您想安排无人值守升级每天运行多次,请在此处查看我的答案:如何不每天而是每隔几个小时运行一次无人值守升级。
GAD*_*D3R 15
如果我想更改我的日程安排,我必须在哪里检查/修改?
在unattended-upgrades
被配置为自动应用。
要验证它检查/etc/apt/apt.conf.d/20auto-upgrades
文件,您将获得:
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
Run Code Online (Sandbox Code Playgroud)
要修改它,您应该运行以下命令:
dpkg-reconfigure -plow unattended-upgrades
Run Code Online (Sandbox Code Playgroud)
示例输出:
Applying updates on a frequent basis is an important part of keeping
systems secure. By default, updates need to be applied manually using
package management tools.
Alternatively, you can choose to have this system automatically download
and install security updates.
Automatically download and install stable updates?
Run Code Online (Sandbox Code Playgroud)
选择NO
停止自动更新
/etc/apt/apt.conf.d/20auto-upgrades
再次验证,你应该得到:
APT::Periodic::Update-Package-Lists "0";
APT::Periodic::Unattended-Upgrade "0";
Run Code Online (Sandbox Code Playgroud)
编辑
要运行unattended-upgrades
每周编辑您/etc/apt/apt.conf.d/20auto-upgrades
的如下:
APT::Periodic::Update-Package-Lists "7";
APT::Periodic::Unattended-Upgrade "1";
Run Code Online (Sandbox Code Playgroud)
可以在 Debian-Wiki 上找到详细示例:通过 /etc/apt/apt.conf.d/02periodic 自动调用
APT::Periodic::Update-Package-Lists
此选项允许您指定刷新包列表的频率(以天为单位)。apticron 用户可以不用这个变量,因为 apticron 已经完成了这个任务。
归档时间: |
|
查看次数: |
19805 次 |
最近记录: |