Skip to main content
Community Scripts logo
Skip to Content
Tools & Add-onsPVE Tools

PVE Cron LXC Updater

Install, update or remove a weekly cron job that updates the operating system of all LXC containers.

cron-update-lxcs.sh is a manager. It downloads the worker script update-lxcs-cron.sh, lets you read it, installs it as a local file and adds a root cron entry that runs that local file. Cron never downloads code at run time.

Website entry: cron-update-lxcs. Source: tools/pve/cron-update-lxcs.sh.

Run

In the Proxmox VE host shell, as root:

bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/cron-update-lxcs.sh)"

The script opens the menu "Cron Update LXCs". Cancel exits.

EntryWhat it does
AddDownloads the worker, prints an installation summary with the SHA256 of the download, asks "Review script content before installing?" (prints the file) and "Install this script and activate cron schedule?". On yes it installs the worker with mode 0755, creates the config file if it is missing and adds the cron entry.
RemoveRemoves the cron entry, the worker and the log file. No confirmation. The config file is kept.
UpdateDownloads the current worker and shows a diff against the installed one with both SHA256 sums. "Apply update?" replaces the installed file. Without changes it reports "already up-to-date".
StatusShows whether the worker is installed (SHA256, install time), the cron schedule, excluded IDs, ping URL, log size and the last run.
RunRuns the installed worker now and appends its output to the log.
ViewSub-menu: Worker (prints the installed script), Cron (cron entry, config file, log size) or Both.
RotateAsks "Rotate log file?" and moves the log to /var/log/update-lxcs-cron.log.old.

Update, Run and View stop with an error if the worker is not installed yet.

Files and cron entry

PathPurpose
/usr/local/bin/update-lxcs.shThe installed worker.
/etc/update-lxcs.confSettings, created by Add if missing.
/var/log/update-lxcs-cron.logOutput of every run.
root crontab0 0 * * 0 /usr/local/bin/update-lxcs.sh >>/var/log/update-lxcs-cron.log 2>&1 (every Sunday at midnight)

Add and Remove also delete an older cron line that contains update-lxcs-cron.sh, the entry earlier versions installed.

Configuration

/etc/update-lxcs.conf as created by Add:

# Configuration for automatic LXC container OS updates.
# Add container IDs to exclude from updates (comma-separated):
# EXCLUDE=100,101,102
EXCLUDE=

# Healthchecks.io Ping URL (optional)
# PING_URL=
KeyEffect
EXCLUDEComma-separated container IDs the worker skips.
PING_URLThe worker requests <PING_URL>/start before the run and sends the log to <PING_URL> on success or <PING_URL>/fail on failure. With a ping URL set, the log file is emptied at the start of every run.

To change the schedule, edit the line with crontab -e. View describes 0 0 * * 0, 0 0 * * * and 0 * * * * in words and calls anything else "Custom schedule"; Status prints the five schedule fields as they are.

Undo

Choose Remove, then delete /etc/update-lxcs.conf by hand if you do not want to keep it.

Limits

  • The manager reads no environment variables.
  • Add does not ask for a schedule; it always writes the Sunday entry and replaces an existing entry for the same file.