update-lxcs-cron (worker)
The non-interactive script that the PVE Cron LXC Updater installs and cron runs to update all LXC containers.
update-lxcs-cron.sh is the worker behind PVE Cron LXC Updater. That manager installs it as /usr/local/bin/update-lxcs.sh. It has no dialogs and is not listed on the website on its own.
Source: tools/pve/update-lxcs-cron.sh.
Run
Install it through the manager and let cron run it, or start the installed copy by hand on the Proxmox VE host as root:
/usr/local/bin/update-lxcs.shContainer IDs given as arguments are skipped, in addition to the ones in the config file:
/usr/local/bin/update-lxcs.sh 100 105What it does
For every container from pct list that is not excluded and not a template:
- A stopped container is started and given 5 seconds.
- The update command for the container's
ostyperuns throughpct exec. - If
/usr/local/bin/patchmon-agentexists in the container,patchmon-agent reportis run. - A container that was started in step 1 is shut down with
pct shutdown <id> --timeout 60.
ostype | Command inside the container |
|---|---|
alpine | apk -U upgrade |
archlinux | pacman -Syyu --noconfirm |
fedora, rocky, centos, alma | dnf -y update && dnf -y upgrade |
ubuntu, debian, devuan | apt-get update, then DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::='--force-confold' dist-upgrade -y, then removes /usr/lib/python3.*/EXTERNALLY-MANAGED |
opensuse | zypper ref && zypper --non-interactive dup |
| anything else | Skipped with [Warn] Unknown OS type. |
--force-confold keeps your existing configuration files when a package ships a new version of one.
Configuration
The worker reads /etc/update-lxcs.conf:
| Key | Effect |
|---|---|
EXCLUDE | Comma-separated container IDs to skip. Only digits and commas are read. |
PING_URL | Healthchecks-style URL. The worker requests <PING_URL>/start first and, when it exits, posts /var/log/update-lxcs-cron.log to <PING_URL> (all updates succeeded) or <PING_URL>/fail (at least one failed). |
When PING_URL is set, the worker truncates /var/log/update-lxcs-cron.log at the start so that only the current run is sent.
Limits
- The worker writes to standard output. The log file only fills because the cron entry redirects into it.
- Unlike the interactive PVE LXC Updater it does not run
autoremoveorautocleanand does not report pending reboots. - It reads no environment variables and sets its own
PATH.