Update gfxcreate.sh
This commit is contained in:
21
gfxcreate.sh
21
gfxcreate.sh
@@ -1,5 +1,24 @@
|
|||||||
#!/bin/bash
|
#!/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)
|
for line in $(cat gfx_hosts)
|
||||||
do
|
do
|
||||||
ip=$(echo $line | cut -d ';' -f 1)
|
ip=$(echo $line | cut -d ';' -f 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user