Update vmcreate1.sh

This commit is contained in:
2025-10-24 13:02:12 +00:00
parent ba4323d352
commit 7da5076238

View File

@@ -12,6 +12,11 @@ show_help()
make_file (){ make_file (){
touch hosts.tmp touch hosts.tmp
for arg in "$@"; do
ipcheck "$arg"
if [ $? -eq 0 ] then
echo -n "$arg " >> ./hosts.tmp
echo $arg | cut -d '.' -f 3,4 | sed 's/\.//'
} }
ip_check (){ ip_check (){
@@ -47,7 +52,7 @@ cat $file | while read line
do do
ip=$(echo $line | cut -d ' ' -f 1) ip=$(echo $line | cut -d ' ' -f 1)
hostname=$(echo $line | cut -d ' ' -f 2) hostname=$(echo $line | cut -d ' ' -f 2)
vmnum=$(echo $ip | cut -d '.' -f 3)(echo $ip | cut -d '.' -f 3) vmnum=$(echo $ip | cut -d '.' -f 3,4 | sed 's/\.//')
qm clone 5000 $vmnum --name $hostname --full qm clone 5000 $vmnum --name $hostname --full
if [ $? -eq 0 ] if [ $? -eq 0 ]
then echo "clone OK" then echo "clone OK"