diff options
| author | Sam Chudnick <sam@chudnick.com> | 2023-06-11 07:56:17 -0400 | 
|---|---|---|
| committer | Sam Chudnick <sam@chudnick.com> | 2023-06-11 07:56:17 -0400 | 
| commit | 9e82c96713989a7565eadac505b36e3dbe91cd5a (patch) | |
| tree | 7c2f998cc9d06f97bfe10ce1ee844121b662f595 /.local/bin/stop-vm | |
| parent | 3adcf542289a0883924ae9b9be8b898c36702c95 (diff) | |
Added, removed, renamed scripts
Diffstat (limited to '.local/bin/stop-vm')
| -rwxr-xr-x | .local/bin/stop-vm | 21 | 
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 | |||
| 4 | opts=$(getopt -o 'as' -l 'all,save' -- "$@") | ||
| 5 | eval set -- "$opts" | ||
| 6 | all=0 | ||
| 7 | save=0 | ||
| 8 | while true | ||
| 9 | do | ||
| 10 | case $1 in | ||
| 11 | '-a'|'--all') all=1; shift; continue ;; | ||
| 12 | '-s'|'--save') save=1; shift; continue ;; | ||
| 13 | '--') shift; break;; | ||
| 14 | esac | ||
| 15 | done | ||
| 16 | |||
| 17 | [ $all -eq 1 ] && domains="$(virsh list | grep running | awk '{print $2}')" || domains="$@" | ||
| 18 | for domain in $domains | ||
| 19 | do | ||
| 20 | [ $save -eq 1 ] && virsh managedsave $domain || virsh shutdown $domain | ||
| 21 | done | ||
