ubuntu 20.04 无人值守升级不启动。 它们应该由 cronjob
/etc/cron.daily/apt-compat
. 启动
脚本的第一部分防止:
# Systemd systems use a systemd timer unit which is preferable to
# run. We want to randomize the apt update and unattended-upgrade
# runs as much as possible to avoid hitting the mirrors all at the
# same time. The systemd time is better at this than the fixed
# cron.daily time
if [ -d /run/systemd/system ]; then
exit 0
fi
我的问题是:如何说服脚本通过 if 条件。我理解评论,但它很抽象。
没有部署包含此目录的包。
# dpkg -S /run/systemd/system
dpkg-query: no path found matching pattern /run/systemd/system
请不要简单地写信给我删除这个目录。它包含文件。
# ls -la /run/systemd/system
total 4
drwxr-xr-x 3 root root 80 May 1 16:28 .
drwxr-xr-x 23 root root 540 May 1 16:28 ..
-rw-r--r-- 1 root root 299 May 1 16:28 netplan-ovs-cleanup.service
drwxr-xr-x 2 root root 60 May 1 16:28 systemd-networkd.service.wants `
我希望无人值守升级从 cronjob 开始。 我使用 set -x 在调试中运行脚本 我在脚本 exec
/usr/lib/apt/apt.systemd.daily
中运行了最终引用的命令。这项工作正常并开始无人值守升级。