diff options
| author | root <root@sg1.noml.ch> | 2025-05-22 18:36:01 +0800 |
|---|---|---|
| committer | root <root@sg1.noml.ch> | 2025-05-22 18:36:01 +0800 |
| commit | 3a52e92fbbbab4df949740f89a389d68281a9428 (patch) | |
| tree | 5cb3b864eb0e3f3b90a1efd9cbdee1fb9f158f4a /others/vm3/compute/rm.sh | |
| parent | 8cb260002db7c46ea5fe2c3f589b485e5f5d970d (diff) | |
Diffstat (limited to 'others/vm3/compute/rm.sh')
| -rwxr-xr-x | others/vm3/compute/rm.sh | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/others/vm3/compute/rm.sh b/others/vm3/compute/rm.sh deleted file mode 100755 index f77831c..0000000 --- a/others/vm3/compute/rm.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -# Check if VMs are provided -if [ $# -eq 0 ]; then - echo "Error: No VM names provided. Usage: $0 vm1 vm2 vm3" - exit 1 -fi - -# List VMs to be removed -echo "The following VMs will be permanently destroyed:" -for vm in "$@"; do - echo "- $vm" -done - -# Confirmation prompt -read -p "Are you sure you want to remove these VMs? (y/N): " confirmation -if [[ ! "$confirmation" =~ ^[Yy]$ ]]; then - echo "Operation cancelled." - exit 1 -fi - -for vm in "$@"; do - sudo virsh destroy "$vm" &>/dev/null - sudo virsh undefine "$vm" --remove-all-storage &>/dev/null - #sudo rm -rf "/var/lib/libvirt/images/${vm}" &>/dev/null - printf "%-50s%10s\n" "Removing $vm..." $([[ $? -eq 0 ]] && echo "Successful" || echo "Failed") -done |
