Skip to content

Instantly share code, notes, and snippets.

@phunehehe
Last active December 14, 2015 19:08
Show Gist options
  • Save phunehehe/5133893 to your computer and use it in GitHub Desktop.
Save phunehehe/5133893 to your computer and use it in GitHub Desktop.

Enable autostart for running VMs

for i in $(virsh list | grep running | awk '{print $2}')
do
    virsh autostart $i
done

Disable autostart for shut-off VMs

for i in $(virsh list --all | grep 'shut off' | awk '{print $2}')
do
    virsh autostart --disable $i
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment