Update create_ct.sh

This commit is contained in:
spiritlhl 2023-05-30 11:44:52 +08:00 committed by GitHub
parent 76d4586f4c
commit 22ef7dea11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# from # from
# https://github.com/spiritLHLS/pve # https://github.com/spiritLHLS/pve
# 2023.04.30 # 2023.05.30
# cd /root # cd /root
@ -131,13 +131,7 @@ build_new_cts(){
if [ -z "$storage" ]; then if [ -z "$storage" ]; then
storage="local" storage="local"
fi fi
output=$(pvesm list | grep "$storage") break
if [ -n "$output" ]; then
echo "存储盘 '$storage' 存在于Proxmox VE中。"
break
else
echo "存储盘 '$storage' 不存在于Proxmox VE中请重新输入"
fi
done done
while true; do while true; do
reading "每个虚拟机分配多少硬盘?(若每个虚拟机分配5G硬盘则输入5)" disk_nums reading "每个虚拟机分配多少硬盘?(若每个虚拟机分配5G硬盘则输入5)" disk_nums
@ -147,6 +141,14 @@ build_new_cts(){
_yellow "输入无效,请输入一个正整数。" _yellow "输入无效,请输入一个正整数。"
fi fi
done done
while true; do
reading "每个虚拟机都使用什么系统?(若都使用debian11则输入debian11或留空)" system
if [ -z "$system" ]; then
system="debian11"
fi
# 这块待增加系统列表查询
break
done
for ((i=1; i<=$new_nums; i++)); do for ((i=1; i<=$new_nums; i++)); do
ct_num=$(($ct_num + 1)) ct_num=$(($ct_num + 1))
ori=$(date | md5sum) ori=$(date | md5sum)
@ -156,7 +158,7 @@ build_new_cts(){
web2_port=$(($web1_port + 1)) web2_port=$(($web1_port + 1))
port_start=$(($port_end + 1)) port_start=$(($port_end + 1))
port_end=$(($port_start + 25)) port_end=$(($port_start + 25))
./buildct.sh $ct_num $password $cpu_nums $memory_nums $disk_nums $ssh_port $web1_port $web2_port $port_start $port_end debian11 $storage ./buildct.sh $ct_num $password $cpu_nums $memory_nums $disk_nums $ssh_port $web1_port $web2_port $port_start $port_end $system $storage
cat "ct$ct_num" >> ctlog cat "ct$ct_num" >> ctlog
rm -rf "ct$ct_num" rm -rf "ct$ct_num"
sleep 60 sleep 60