Update check_kernal.sh

This commit is contained in:
spiritLHLS 2023-04-12 09:29:25 +08:00 committed by GitHub
parent 5db686e4ac
commit 5c818c8c1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,3 +43,30 @@ if ! lsmod | grep -q kvm; then
echo "kvm" >> /etc/modules
_green "KVM模块已加载并添加到 /etc/modules可以尝试使用PVE虚拟化KVM服务器也可以开LXC服务器(CT)"
fi
check_config(){
# 检查CPU核心数
cpu_cores=$(grep -c ^processor /proc/cpuinfo)
if [ "$cpu_cores" -lt 2 ]; then
_yellow "服务器不满足最低要求至少2核CPU"
return
fi
# 检查内存大小
total_mem=$(free -m | awk '/^Mem:/{print $2}')
if [ "$total_mem" -lt 2048 ]; then
_yellow "服务器不满足最低要求至少2G内存"
return
fi
# 检查硬盘大小
total_disk=$(df -h / | awk '/\//{print $2}')
if [ "$total_disk" -lt 20 ]; then
_yellow "服务器不满足最低要求至少20G硬盘"
return
fi
_green "服务器满足至少2核2G内存20G硬盘的最低要求"
}
check_config