Aug22
[Proxmox] Laufende Container aktualisieren
am 22. August 2019 um 22:17:38Hat man nur 2-3 Container, ist es ja absolut kein Problem, die Händisch mal eben zu Aktualisieren. Hat man aber >20 pro Server macht es keinen Spaß, das per Hand zu regeln.
Das einfach direkt als Root auf dem Proxmox-Host ausgeführt:
[22/08-22:07] root@89.238.75.2:~]# cat update-containers.sh #!/bin/bash # update all containers # list of running container-ids containers=$(pct list|grep -i running|tail -n +2 | cut -f1 -d' ') function update_container() { container=$1 echo "Updating $container..." ## pct exec $container -- bash -c "apt update && apt upgrade -y" ## For Debian-Based Containers pct exec $container -- bash -c "yes|pacman -Suuyy && reboot" ## For Archlinux oder using pacapt } for container in $containers do update_container $container done [22/08-22:07] root@89.238.75.2:~]# |
Aktualisiert dir alle derzeit laufenden Container.
Funktioniert hier auf zwei Proxmox-Instanzen (6.0-4) problemlos.