Files
scripts/lxc-toolbox-README.md
T
2026-10-28 12:55:56 +01:00

3.0 KiB

Proxmox LXC toolbox

A Bash menu for choosing maintenance tasks and the containers to run them on. Run as root on the Proxmox host, with Bash 4+, curl and pct installed.

Publish on your Gitea server

  1. Open https://codealvin.xyz/Alvin-Zilverstand/scripts and select the main branch.
  2. Use the repository's upload-file action and upload lxc-toolbox.sh to the repository root. If it already exists, replace/edit that file instead.
  3. Commit the file to main. The four existing maintenance scripts stay in place.

After publishing, open the menu with:

bash <(curl -fsSL https://codealvin.xyz/Alvin-Zilverstand/scripts/raw/branch/main/lxc-toolbox.sh)

Choose tasks by number (for example 1 2 3) or a for all four. Then choose container IDs separated by spaces or commas (for example 101 105), or a for all listed containers. Enter q to quit.

Command-line examples

Run every task on containers 101 and 105:

bash <(curl -fsSL https://codealvin.xyz/Alvin-Zilverstand/scripts/raw/branch/main/lxc-toolbox.sh) --all --ctids 101,105

Run selected tasks on selected containers:

bash lxc-toolbox.sh locale proxy docker --ctids '101 105'

Run every task on all currently listed containers:

bash lxc-toolbox.sh --all --all-lxcs

--all selects tasks, while --all-lxcs selects containers. Omitting the container option opens the container prompt. The APT cacher script still asks whether to run apt update, so these commands are interactive.

Behavior

  • Tasks run in this order: locale, APT cacher, Docker repository conversion, backup cleanup.
  • Selected scripts are downloaded from this repository's main branch and syntax-checked before any task starts.
  • An exported Bash pct function filters pct list to the selected IDs and permits status, config, and exec only for those IDs. This supports the current upstream scripts without editing them; it is not a security sandbox. Future upstream scripts must continue to use ordinary pct calls, rather than bypassing the function with an absolute executable path or command pct.
  • Unknown IDs are rejected before downloading/running tasks; duplicates are removed. The existing scripts skip stopped containers and non-Debian containers.
  • The existing proxy address remains 192.168.178.22:3142, and the locale remains en_US.UTF-8. Change those in their respective upstream scripts if needed.
  • Docker conversion changes repository URLs from HTTPS to HTTP. Cleanup uses the existing script's deletion rules and does not remove backups stored under /root/apt-backups/docker.
  • A nonzero script exit stops the sequence. Some upstream scripts print per-container errors but return success; inspect their output. Already-completed changes are not rolled back.

Validation used mocked Proxmox commands with the current upstream scripts, covering selection, multiple IDs, skip behavior, invalid inputs, interactive selection, all-container mode, download failure, and direct calls to unselected IDs. No live containers were modified during testing.