# 📦 Proxmox Container Update Script A powerful utility script for managing updates across multiple Proxmox containers with flexible options and detailed logging. ## 🔍 Overview `pct_update.sh` simplifies the maintenance of Proxmox containers by providing an easy way to check, update, and upgrade packages across multiple containers simultaneously. It supports various Linux distributions and offers extensive customization options for handling container updates efficiently. ## ✨ Features - **Status Checking**: Quickly identify containers with pending updates - **Package Management**: Update package caches or perform full system upgrades - **Selective Processing**: Include or exclude specific containers by ID - **Container Control**: Boot non-running containers before operations - **Safety Options**: Dry-run mode to test without making changes - **Automation Support**: Non-interactive mode for scheduled tasks - **Comprehensive Logging**: Color-coded logs with adjustable verbosity - **OS Support**: Works with Debian, Ubuntu, Alpine, CentOS, Fedora, and RHEL ## 🚀 Installation 1. Clone the repository or download the script 2. Make the script executable: ```bash chmod +x pct_update.sh ``` 3. Run the script with appropriate options (see Usage) Optionally you can save the script to `/usr/local/sbin` to make it available system wide: ```bash sudo cp pct_update.sh /usr/local/sbin/pct_update sudo chmod +x /usr/local/sbin/pct_update ``` ## 🛠️ Usage ```bash ./pct_update.sh [options] ``` (or, if globally installed) ```bash pct_update [options] ``` ### ⚙️ Options - `-s` : Get the package status of each container. - `-u` : Update the package cache, but do not upgrade. - `-U` : Perform upgrades on all containers. - `-x ` : Exclude a container by its ID (can be used multiple times). - `-i ` : Include only specific containers by their IDs (can be used multiple times). - `-y` : Assume 'yes' for all operations (asks once). - `-Y` : Assume 'yes' for all operations without asking (for automation). - `-b` : Boot non-running containers before performing actions. - `-B ` : Boot a specific container by its ID (can be used multiple times). - `-d` : Dry-run mode (simulate actions without making changes). - `-v` : Enable verbose mode. - `-h` : Print this help and exit. ## 💻 Prerequisites Ensure the following commands are available on your system: - `awk` - `grep` - `pct` (Proxmox Container Toolkit) ## 🚨 Warnings - Running as root: The script will warn if executed as root. Ensure this is necessary for your operations. - Conflicts: Avoid using both `-b` and `-B` options simultaneously, as they may lead to unintended behavior. ## 📋 Examples - **Check package status for all containers**: ```bash ./pct_update.sh -s ``` - **Update package cache for specific containers**: ```bash ./pct_update.sh -u -i 101 -i 102 ``` - **Upgrade all containers, excluding some**: ```bash ./pct_update.sh -U -x 103 -x 104 ``` - **Dry-run an upgrade for all containers**: ```bash ./pct_update.sh -Ud ``` - **Boot a specific container before upgrade**: ```bash ./pct_update.sh -U -B 105 ``` - **Update all containers without asking for confirmation**: ```bash ./pct_update.sh -YU ``` ## 📝 Logging The script provides detailed logging for each operation, categorized by: - **DEBUG**: Detailed information for debugging. - **INFO**: General information about the operations. - **WARNING**: Potential issues that do not stop the script. - **ERROR**: Critical issues that prevent operations. ## 🤝 Contributions Contributions are welcome! Feel free to open issues or submit pull requests to improve this script. ## 📄 License This project is licensed under the [MIT License](https://git.zion-networks.de/ZionNetworks/linux-bash-scripts/src/branch/main/LICENSE). --- Happy updating! 🎉