From aef5c4ea101bd51e27492df3ae07f116aec6ca6c Mon Sep 17 00:00:00 2001 From: dr Date: Fri, 23 Feb 2024 10:24:19 +0800 Subject: [PATCH] Update tcpx.sh --- tcpx.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tcpx.sh b/tcpx.sh index a54f23aa..a888b19d 100644 --- a/tcpx.sh +++ b/tcpx.sh @@ -194,6 +194,21 @@ check_empty() { #检查磁盘空间 check_disk_space() { + # 检查是否存在 bc 命令 + if ! command -v bc &> /dev/null; then + echo "安装 bc 命令..." + # 检查系统类型并安装相应的 bc 包 + if [ -f /etc/redhat-release ]; then + yum install -y bc + elif [ -f /etc/debian_version ]; then + apt-get update + apt-get install -y bc + else + echo "无法确定系统类型,请手动安装 bc 命令。" + return 1 + fi + fi + # 获取当前磁盘剩余空间 available_space=$(df -h / | awk 'NR==2 {print $4}') @@ -208,7 +223,6 @@ check_disk_space() { fi } - #安装BBR内核 installbbr() { kernel_version="5.9.6"