summaryrefslogtreecommitdiff
path: root/.local/bin/stop-vm
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/stop-vm')
-rwxr-xr-x.local/bin/stop-vm21
1 files changed, 0 insertions, 21 deletions
diff --git a/.local/bin/stop-vm b/.local/bin/stop-vm
deleted file mode 100755
index 6c92250..0000000
--- a/.local/bin/stop-vm
+++ /dev/null
@@ -1,21 +0,0 @@
1#!/bin/sh
2# Stops domains given as arguments
3
4opts=$(getopt -o 'as' -l 'all,save' -- "$@")
5eval set -- "$opts"
6all=0
7save=0
8while true
9do
10 case $1 in
11 '-a'|'--all') all=1; shift; continue ;;
12 '-s'|'--save') save=1; shift; continue ;;
13 '--') shift; break;;
14 esac
15done
16
17[ $all -eq 1 ] && domains="$(virsh list | grep running | awk '{print $2}')" || domains="$@"
18for domain in $domains
19do
20 [ $save -eq 1 ] && virsh managedsave $domain || virsh shutdown $domain
21done