Update buildct.sh

This commit is contained in:
spiritLHLS 2023-05-20 09:56:19 +08:00 committed by GitHub
parent 659199607d
commit 9b0406df61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,10 +1,10 @@
#!/bin/bash
# from
# https://github.com/spiritLHLS/pve
# 2023.04.24
# 2023.05.20
# ./buildct.sh CTID 密码 CPU核数 内存 硬盘 SSH端口 80端口 443端口 外网端口起 外网端口止 系统
# ./buildct.sh 102 1234567 1 512 5 20001 20002 20003 30000 30025 debian11
# ./buildct.sh CTID 密码 CPU核数 内存 硬盘 SSH端口 80端口 443端口 外网端口起 外网端口止 系统 存储盘
# ./buildct.sh 102 1234567 1 512 5 20001 20002 20003 30000 30025 debian11 local
# 用颜色输出信息
_red() { echo -e "\033[31m\033[01m$@\033[0m"; }
@ -34,6 +34,7 @@ web2_port="${8:-20003}"
port_first="${9:-29975}"
port_last="${10:-30000}"
system_ori="${11:-debian11}"
storage="${12:-local}"
rm -rf "ct$name"
en_system=$(echo "$system_ori" | sed 's/[0-9]*//g')
num_system=$(echo "$system_ori" | sed 's/[a-zA-Z]*//g')
@ -84,7 +85,7 @@ else
num=$((first_digit - 2))$second_digit$third_digit
fi
user_ip="172.16.1.${num}"
pct create $CTID local:vztmpl/$system_name -cores $core -cpuunits 1024 -memory $memory -swap 128 -rootfs local:${disk} -onboot 1 -password $password -features nesting=1
pct create $CTID ${storage}:vztmpl/$system_name -cores $core -cpuunits 1024 -memory $memory -swap 128 -rootfs local:${disk} -onboot 1 -password $password -features nesting=1
pct start $CTID
pct set $CTID --hostname $CTID
pct set $CTID --net0 name=eth0,ip=${user_ip}/24,bridge=vmbr1,gw=172.16.1.1