如果自动升级需要重新启动,则在特定时间自动重新启动

Abd*_*med 6 ubuntu automatic-updates reboot

我设置了自动更新,它会自动更新。但是,有些更新需要重新启动,我知道

Unattended-Upgrade::Automatic-Reboot "true";
Run Code Online (Sandbox Code Playgroud)

将其设置为重新启动。但是一更新就重启。这可能是在一天中的任何时间,当我的用户使用我的服务器时。我希望它在特定时间重新启动,比如当天晚上 12:00。我怎么做?

And*_*man 8

查看 /etc/apt/apt.conf.d/50unattended-upgrades。你要Unattended-Upgrade::Automatic-Reboot-Time

// If automatic reboot is enabled and needed, reboot at the specific
// time instead of immediately
//  Default: "now"
//Unattended-Upgrade::Automatic-Reboot-Time "02:00";
Run Code Online (Sandbox Code Playgroud)

它需要提供的时间并将其用于/sbin/shutdown -r来源)。这意味着您可以使用shutdown您设置的时区内接受的任何时间。

  • 你知道这个时间是本地时区还是UTC时间吗?我没有看到 [`unattended-upgrade(8)`](https://manpages.debian.org/bullseye/unattended-upgrades/unattended-upgrade.8.en.html) 中提到的这个细节。 (2认同)