From a42ec4e64edec197ce54c3df12e597b8598364cd Mon Sep 17 00:00:00 2001 From: Dmitry Badovsky Date: Wed, 29 Oct 2025 10:51:59 +0000 Subject: [PATCH] Update gfxcreate.sh --- gfxcreate.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/gfxcreate.sh b/gfxcreate.sh index ce25fa4..24fb6d2 100644 --- a/gfxcreate.sh +++ b/gfxcreate.sh @@ -1,5 +1,24 @@ #!/bin/bash -sed -i "s/ //g gfx_hosts" +remove=false +while getopts "R" opt; do + case $opt in + R) remove=true;; + \?) echo "Invalid option."; exit 1;; + esac +done + +if $remove; then + for line in $(cat gfx_hosts) + do + ip=$(echo $line | cut -d ';' -f 1) + vmid=$(echo $ip | cut -d '.' -f 3,4 | sed 's/\.// ') + qm stop $vmid + qm destroy $vmid --destroy-unreferenced-disks --purge + done + echo "Specified VMs REMOVED." + exit 0 +fi + for line in $(cat gfx_hosts) do ip=$(echo $line | cut -d ';' -f 1)