apt-get "Automatic-Reboot-Time" 的可能值

Pet*_*ner 5 reboot apt unattended-upgrades

/etc/apt/apt.conf.d/50unattended-upgrades说默认的自动重启时间是现在,除非你把它设置为一个时间。放入配置文件并注释掉的时间是02:00但我不想将其设置为一天中的特定时间。我的 ubuntu 服务器有每周维护窗口,我想将其设置为那时。这只是 at 工作的参数吗?换句话说,我可以在“星期三下午茶时间”重启我的服务器吗?

ste*_*ver 5

unattended-upgrade程序是一个python脚本,其相关部分似乎是:

# reboot at the specified time
when = apt_pkg.config.find(
    "Unattended-Upgrade::Automatic-Reboot-Time", "now")
if shutdown_lock > 0:
    os.close(shutdown_lock)
logging.warning("Found %s, rebooting" % REBOOT_REQUIRED_FILE)
subprocess.call(["/sbin/shutdown", "-r", when])
Run Code Online (Sandbox Code Playgroud)

因此,支持的时间格式是 支持的格式/sbin/shutdown,即 (from man shutdown):

The time string may either be in the format "hh:mm" for hour/minutes
specifying the time to execute the shutdown at, specified in 24h clock
format. Alternatively it may be in the syntax "+m" referring to the
specified number of minutes m from now.  "now" is an alias for "+0",
i.e. for triggering an immediate shutdown. If no time argument is
specified, "+1" is implied.
Run Code Online (Sandbox Code Playgroud)