Last active
December 21, 2024 09:13
-
-
Save NiceRath/5810cb613c347cfad8975718e59eafea to your computer and use it in GitHub Desktop.
Proxmox - Shutdown all VMs and Containers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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