大网数据广告活动
服务器运维问答

Automatic Reboot at specific time if Automatic Upgrade requires Reboot

· 52CE 我爱测

I have setup automatic updates and it updates automatically. However, there are updates that require a restart and I know Unattended-Upgrade::Automatic-Reboot "true"; will set it to reboot. But it reboots as soon as it updates. T…

问题原文

原帖链接 · Abdulsattar Mohammed · CC BY-SA 4.0

I have setup automatic updates and it updates automatically. However, there are updates that require a restart and I know

Unattended-Upgrade::Automatic-Reboot "true";

will set it to reboot. But it reboots as soon as it updates. That could be at any time of the day, when my users are using my server. I want it to restart at a specific time, say 12:00 am that night. How do I do that?

已采纳解答

原帖链接 · Andrew Schulman · CC BY-SA 4.0

Have a look in /etc/apt/apt.conf.d/50unattended-upgrades. You want 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";

It takes the time provided and uses it on /sbin/shutdown -r (source). This means you can use any time that shutdown accepts, in your set timezone.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-11-18)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。