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
- Open https://codealvin.xyz/Alvin-Zilverstand/scripts and select the
mainbranch. - Use the repository's upload-file action and upload
lxc-toolbox.shto the repository root. If it already exists, replace/edit that file instead. - 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
mainbranch and syntax-checked before any task starts. - An exported Bash
pctfunction filterspct listto the selected IDs and permitsstatus,config, andexeconly 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 ordinarypctcalls, rather than bypassing the function with an absolute executable path orcommand 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 remainsen_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.