Skip to content

Instantly share code, notes, and snippets.

@xoner
Created November 7, 2016 08:51
Show Gist options
  • Save xoner/ede1b970b982ebe601f87403e7356e0a to your computer and use it in GitHub Desktop.
Save xoner/ede1b970b982ebe601f87403e7356e0a to your computer and use it in GitHub Desktop.
Bash script that shuts down all the running machines in a kvm host
#!/bin/bash
#
# Shuts down all the machines that are currently running in a kvm host
for machine in $(virsh list | tail -n +3 | awk '{print $2}');
do
echo "Sutting down $machine"
virsh shutdown $machine
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment