Skip to content

Instantly share code, notes, and snippets.

@NiceRath
Last active December 21, 2024 09:13
Show Gist options
  • Save NiceRath/5810cb613c347cfad8975718e59eafea to your computer and use it in GitHub Desktop.
Save NiceRath/5810cb613c347cfad8975718e59eafea to your computer and use it in GitHub Desktop.
Proxmox - Shutdown all VMs and Containers
#!/bin/bash
vms="$(qm list | sed 's|^\s*||g' | cut -d ' ' -f1 | tail -n +2)"
for vm in $vms
do
echo "Shutdown vm $vm"
qm shutdown "$vm"
done
cts="$(pct list | sed 's|^\s*||g' | cut -d ' ' -f1 | tail -n +2)"
for ct in $cts
do
echo "Shutdown ct $ct"
pct shutdown "$ct"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment