Update gfxcreate.sh

This commit is contained in:
2025-10-29 10:51:59 +00:00
parent 98fcdf2128
commit a42ec4e64e

View File

@@ -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)