Advertisement
gregorst

Update all proxmox coontainers

Apr 11th, 2020
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.43 KB | None | 0 0
  1. #!/bin/bash
  2. # update all containers
  3.  
  4. # list of container ids we need to iterate through
  5. containers=$(pct list | tail -n +2 | cut -f1 -d' ')
  6.  
  7. function update_container() {
  8.   container=$1
  9.   echo "Updating $container..."
  10.   # to chain commands within one exec we will need to wrap them in bash
  11.   pct exec $container -- bash -c "apt update && apt upgrade -y"
  12. }
  13.  
  14. for container in $containers
  15. do
  16.   update_container $container
  17. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement