apt-get“自动重启时间”的可能值


4

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

Answers:


4

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])

因此,支持的时间格式就是所支持的时间格式/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.

3

Ubuntu存储库中的当前版本尚不支持此功能。

但是,如果您从GitHub 克隆当前版本,则可以{"Tue"};在配置文件中设置“ Update-Days like:” ,因此它将仅在您指定的星期二重启。


这是Ubuntu 18.04的一部分吗?
Houman

我认为此选项控制应用更新的频率,而不是重新启动的频率。我希望每天安装更新,但仅每周重新启动一次。
Sam Bull
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.