commit 0b0b5a56be03b3bf7380a3014273fed92863fbdc Author: dgsoft Date: Mon May 12 21:48:57 2025 +0200 first commit diff --git a/proxmox/update-containers.sh b/proxmox/update-containers.sh new file mode 100644 index 0000000..6296d4c --- /dev/null +++ b/proxmox/update-containers.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root" + exit 1 +fi + +for CTID in $(pct list | tail -n+2 | awk '{print $1}'); do + echo "==> Checking container $CTID..." + + if pct exec $CTID -- which apt >/dev/null 2>&1; then + echo "-> apt found. Running update & upgrade..." + pct exec $CTID -- apt -qq update + pct exec $CTID -- apt -qq upgrade -y + elif pct exec $CTID -- which apt-get >/dev/null 2>&1; then + echo "-> apt-get found. Running update & upgrade..." + pct exec $CTID -- apt-get -qq update + pct exec $CTID -- apt-get -qq upgrade -y + elif pct exec $CTID -- which dnf >/dev/null 2>&1; then + echo "-> dnf found. Running update..." + pct exec $CTID -- dnf -y upgrade --refresh + elif pct exec $CTID -- which yum >/dev/null 2>&1; then + echo "-> yum found. Running update..." + pct exec $CTID -- yum -y update + else + echo "-> No package manager found in container $CTID – skipping." + fi + + echo +done