Compare commits

..

10 Commits

Author SHA1 Message Date
丰仔
616ed2bf1c
Update README.md 2024-08-13 15:48:40 +08:00
Jensfrank
31ca394378
Update Nlbench_beta.sh 2024-08-13 15:35:15 +08:00
Jensfrank
ebf7e3df30
Update Nlbench_beta.sh 2024-08-13 15:32:19 +08:00
Jensfrank
6dfa75f038
Update Nlbench.sh 2024-08-13 15:13:44 +08:00
Jensfrank
c2fac4dbab
Update version.sh 2024-08-13 15:05:21 +08:00
Jensfrank
8cae62c634
Update Nlbench.sh 2024-08-13 15:04:53 +08:00
Jensfrank
bfb733e2b9
Update Nlbench.sh 2024-08-13 15:04:44 +08:00
Jensfrank
63e0193f36
Update Nlbench_beta.sh 2024-08-13 14:53:44 +08:00
Jensfrank
de83bd263f
Update Nlbench_beta.sh 2024-08-13 14:40:05 +08:00
Jensfrank
f4abd4a5ae
Update Nlbench_beta.sh 2024-08-13 14:37:49 +08:00
4 changed files with 74 additions and 33 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# 定义版本 # 定义版本
CURRENT_VERSION="2024-08-08 v1.1.1" # 最新版本号 CURRENT_VERSION="2024-08-13 v1.1.2" # 最新版本号
SCRIPT_URL="https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/Nlbench.sh" SCRIPT_URL="https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/Nlbench.sh"
VERSION_URL="https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/version.sh" VERSION_URL="https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/version.sh"
@ -427,7 +427,6 @@ run_script() {
echo "使用IPv4测试选项" echo "使用IPv4测试选项"
wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && bash AutoTrace.sh <<< "1" | tee "$temp_file" wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && bash AutoTrace.sh <<< "1" | tee "$temp_file"
fi fi
// sed -i -e 's/\x1B\[[0-9;]*[JKmsu]//g' -e '/测试项/,+9d' -e '/信息/d' -e '/^\s*$/d' "$temp_file"
sed -i -e 's/\x1B\[[0-9;]*[JKmsu]//g' -e '/No:1\/9 Traceroute to/,$!d' -e '/测试项/,+9d' -e '/信息/d' -e '/^\s*$/d' "$temp_file" sed -i -e 's/\x1B\[[0-9;]*[JKmsu]//g' -e '/No:1\/9 Traceroute to/,$!d' -e '/测试项/,+9d' -e '/信息/d' -e '/^\s*$/d' "$temp_file"
cp "$temp_file" "${output_file}_route" cp "$temp_file" "${output_file}_route"
;; ;;
@ -442,24 +441,25 @@ generate_markdown_output() {
local final_output_file="${base_output_file}.md" local final_output_file="${base_output_file}.md"
local sections=("YABS" "Geekbench5" "融合怪" "IP质量" "流媒体" "响应" "多线程测速" "单线程测速" "iperf3" "回程路由") local sections=("YABS" "Geekbench5" "融合怪" "IP质量" "流媒体" "响应" "多线程测速" "单线程测速" "iperf3" "回程路由")
local file_suffixes=("yabs" "gb5" "fusion" "ip_quality" "streaming" "response" "multi_thread" "single_thread" "iperf3" "route") local file_suffixes=("yabs" "gb5" "fusion" "ip_quality" "streaming" "response" "multi_thread" "single_thread" "iperf3" "route")
local empty_tabs=("去程路由" "Ping.pe" "哪吒 ICMP" "其他")
echo "[tabs]" > "$final_output_file" echo "[tabs]" > "$final_output_file"
# 输出有内容的标签
for i in "${!sections[@]}"; do for i in "${!sections[@]}"; do
section="${sections[$i]}" section="${sections[$i]}"
suffix="${file_suffixes[$i]}" suffix="${file_suffixes[$i]}"
echo "[tab=\"$section\"]" >> "$final_output_file"
echo "\`\`\`" >> "$final_output_file"
if [ -f "${base_output_file}_${suffix}" ]; then if [ -f "${base_output_file}_${suffix}" ]; then
echo "[tab=\"$section\"]" >> "$final_output_file"
echo "\`\`\`" >> "$final_output_file"
cat "${base_output_file}_${suffix}" >> "$final_output_file" cat "${base_output_file}_${suffix}" >> "$final_output_file"
echo "\`\`\`" >> "$final_output_file"
echo "[/tab]" >> "$final_output_file"
rm "${base_output_file}_${suffix}" rm "${base_output_file}_${suffix}"
fi fi
echo "\`\`\`" >> "$final_output_file"
echo "[/tab]" >> "$final_output_file"
done done
# Adding remaining empty tabs # 添加保留的空白标签
local empty_tabs=("去程路由" "Ping.pe" "哪吒 ICMP" "其他")
for tab in "${empty_tabs[@]}"; do for tab in "${empty_tabs[@]}"; do
echo "[tab=\"$tab\"]" >> "$final_output_file" echo "[tab=\"$tab\"]" >> "$final_output_file"
echo "[/tab]" >> "$final_output_file" echo "[/tab]" >> "$final_output_file"

View File

@ -113,10 +113,17 @@ detect_os() {
. /etc/lsb-release . /etc/lsb-release
os_type=$DISTRIB_ID os_type=$DISTRIB_ID
os_version=$DISTRIB_RELEASE os_version=$DISTRIB_RELEASE
elif [ -f /etc/redhat-release ]; then
os_type=$(cat /etc/redhat-release | cut -d ' ' -f 1)
os_version=$(cat /etc/redhat-release | sed 's/.*release \([0-9\.]*\).*/\1/')
elif [ -f /etc/gentoo-release ]; then
os_type="gentoo"
os_version=$(cat /etc/gentoo-release | cut -d ' ' -f 5)
else else
echo -e "${RED}无法检测操作系统类型和版本。${NC}" os_type=$(uname -s)
return 1 os_version=$(uname -r)
fi fi
os_type=$(echo "$os_type" | tr '[:upper:]' '[:lower:]')
echo -e "${YELLOW}检测到的系统: $os_type $os_version${NC}" echo -e "${YELLOW}检测到的系统: $os_type $os_version${NC}"
} }
@ -124,15 +131,14 @@ detect_os() {
update_system() { update_system() {
detect_os || return 1 detect_os || return 1
# 根据操作系统类型选择更新命令
case "${os_type,,}" in case "${os_type,,}" in
ubuntu|debian|linuxmint|elementary|pop) ubuntu|debian|linuxmint|elementary|pop)
update_cmd="apt-get update" update_cmd="apt-get update"
upgrade_cmd="apt-get upgrade -y" upgrade_cmd="apt-get upgrade -y"
install_cmd="apt-get install -y" install_cmd="apt-get install -y"
;; ;;
fedora|centos|rhel|ol|rocky|almalinux) centos|rhel|fedora|rocky|almalinux|openeuler)
if [ "${os_version%%.*}" -ge 22 ] || [ "${os_version%%.*}" -ge 8 ]; then if command -v dnf &>/dev/null; then
update_cmd="dnf check-update" update_cmd="dnf check-update"
upgrade_cmd="dnf upgrade -y" upgrade_cmd="dnf upgrade -y"
install_cmd="dnf install -y" install_cmd="dnf install -y"
@ -157,6 +163,16 @@ update_system() {
upgrade_cmd="apk upgrade" upgrade_cmd="apk upgrade"
install_cmd="apk add" install_cmd="apk add"
;; ;;
gentoo)
update_cmd="emerge --sync"
upgrade_cmd="emerge -uDN @world"
install_cmd="emerge"
;;
cloudlinux)
update_cmd="yum check-update"
upgrade_cmd="yum upgrade -y"
install_cmd="yum install -y"
;;
*) *)
echo -e "${RED}不支持的 Linux 发行版: $os_type${NC}" echo -e "${RED}不支持的 Linux 发行版: $os_type${NC}"
return 1 return 1
@ -189,16 +205,32 @@ install_dependencies() {
# 安装依赖 # 安装依赖
local dependencies=("curl" "wget" "iperf3") local dependencies=("curl" "wget" "iperf3")
for dep in "${dependencies[@]}"; do case "${os_type,,}" in
if ! command -v "$dep" &> /dev/null; then gentoo)
echo -e "${YELLOW}正在安装 $dep...${NC}" for dep in "${dependencies[@]}"; do
if ! sudo $install_cmd "$dep"; then if ! emerge -p $dep &>/dev/null; then
echo -e "${RED}无法安装 $dep。请手动安装此依赖项。${NC}" echo -e "${YELLOW}正在安装 $dep...${NC}"
fi if ! sudo emerge $dep; then
else echo -e "${RED}无法安装 $dep。请手动安装此依赖项。${NC}"
echo -e "${GREEN}$dep 已安装。${NC}" fi
fi else
done echo -e "${GREEN}$dep 已安装。${NC}"
fi
done
;;
*)
for dep in "${dependencies[@]}"; do
if ! command -v "$dep" &> /dev/null; then
echo -e "${YELLOW}正在安装 $dep...${NC}"
if ! sudo $install_cmd "$dep"; then
echo -e "${RED}无法安装 $dep。请手动安装此依赖项。${NC}"
fi
else
echo -e "${GREEN}$dep 已安装。${NC}"
fi
done
;;
esac
echo -e "${GREEN}依赖项检查和安装完成。${NC}" echo -e "${GREEN}依赖项检查和安装完成。${NC}"
clear clear
@ -298,7 +330,7 @@ run_script() {
# YABS # YABS
1) 1)
echo -e "运行${YELLOW}YABS...${NC}" echo -e "运行${YELLOW}YABS...${NC}"
curl -sL yabs.sh | bash -s -- -i -5 -6 | tee "$temp_file" curl -sL yabs.sh | bash -s -- -i -5 | tee "$temp_file"
sed -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file" sed -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file"
sed -i 's/\.\.\./\.\.\.\n/g' "$temp_file" sed -i 's/\.\.\./\.\.\.\n/g' "$temp_file"
sed -i '/\.\.\./d' "$temp_file" sed -i '/\.\.\./d' "$temp_file"
@ -348,7 +380,7 @@ run_script() {
# IP质量 # IP质量
4) 4)
echo -e "运行${YELLOW}IP质量测试...${NC}" echo -e "运行${YELLOW}IP质量测试...${NC}"
bash <(curl -Ls IP.Check.Place) | tee "$temp_file" echo y | bash <(curl -Ls IP.Check.Place) | tee "$temp_file"
sed -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file" sed -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file"
sed -i -r 's/(⠋|⠙|⠹|⠸|⠼|⠴|⠦|⠧|⠇|⠏)/\n/g' "$temp_file" sed -i -r 's/(⠋|⠙|⠹|⠸|⠼|⠴|⠦|⠧|⠇|⠏)/\n/g' "$temp_file"
sed -i -r '/正在检测/d' "$temp_file" sed -i -r '/正在检测/d' "$temp_file"
@ -427,7 +459,7 @@ run_script() {
echo "使用IPv4测试选项" echo "使用IPv4测试选项"
wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && bash AutoTrace.sh <<< "1" | tee "$temp_file" wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && bash AutoTrace.sh <<< "1" | tee "$temp_file"
fi fi
sed -i -e 's/\x1B\[[0-9;]*[JKmsu]//g' -e '/测试项/,+9d' -e '/信息/d' -e '/^\s*$/d' "$temp_file" sed -i -e 's/\x1B\[[0-9;]*[JKmsu]//g' -e '/No:1\/9 Traceroute to/,$!d' -e '/测试项/,+9d' -e '/信息/d' -e '/^\s*$/d' "$temp_file"
cp "$temp_file" "${output_file}_route" cp "$temp_file" "${output_file}_route"
;; ;;
esac esac
@ -441,24 +473,25 @@ generate_markdown_output() {
local final_output_file="${base_output_file}.md" local final_output_file="${base_output_file}.md"
local sections=("YABS" "Geekbench5" "融合怪" "IP质量" "流媒体" "响应" "多线程测速" "单线程测速" "iperf3" "回程路由") local sections=("YABS" "Geekbench5" "融合怪" "IP质量" "流媒体" "响应" "多线程测速" "单线程测速" "iperf3" "回程路由")
local file_suffixes=("yabs" "gb5" "fusion" "ip_quality" "streaming" "response" "multi_thread" "single_thread" "iperf3" "route") local file_suffixes=("yabs" "gb5" "fusion" "ip_quality" "streaming" "response" "multi_thread" "single_thread" "iperf3" "route")
local empty_tabs=("去程路由" "Ping.pe" "哪吒 ICMP" "其他")
echo "[tabs]" > "$final_output_file" echo "[tabs]" > "$final_output_file"
# 输出有内容的标签
for i in "${!sections[@]}"; do for i in "${!sections[@]}"; do
section="${sections[$i]}" section="${sections[$i]}"
suffix="${file_suffixes[$i]}" suffix="${file_suffixes[$i]}"
echo "[tab=\"$section\"]" >> "$final_output_file"
echo "\`\`\`" >> "$final_output_file"
if [ -f "${base_output_file}_${suffix}" ]; then if [ -f "${base_output_file}_${suffix}" ]; then
echo "[tab=\"$section\"]" >> "$final_output_file"
echo "\`\`\`" >> "$final_output_file"
cat "${base_output_file}_${suffix}" >> "$final_output_file" cat "${base_output_file}_${suffix}" >> "$final_output_file"
echo "\`\`\`" >> "$final_output_file"
echo "[/tab]" >> "$final_output_file"
rm "${base_output_file}_${suffix}" rm "${base_output_file}_${suffix}"
fi fi
echo "\`\`\`" >> "$final_output_file"
echo "[/tab]" >> "$final_output_file"
done done
# Adding remaining empty tabs # 添加保留的空白标签
local empty_tabs=("去程路由" "Ping.pe" "哪吒 ICMP" "其他")
for tab in "${empty_tabs[@]}"; do for tab in "${empty_tabs[@]}"; do
echo "[tab=\"$tab\"]" >> "$final_output_file" echo "[tab=\"$tab\"]" >> "$final_output_file"
echo "[/tab]" >> "$final_output_file" echo "[/tab]" >> "$final_output_file"
@ -471,6 +504,7 @@ generate_markdown_output() {
clear clear
} }
# 执行全部脚本 # 执行全部脚本
run_all_scripts() { run_all_scripts() {
local base_output_file="NLvps_results_$(date +%Y%m%d_%H%M%S)" local base_output_file="NLvps_results_$(date +%Y%m%d_%H%M%S)"

View File

@ -11,7 +11,13 @@
### 使用方法 ### 使用方法
确保用户为ROOT主机网络通畅复制下面任意命令运行 确保用户为ROOT主机网络通畅复制下面任意命令运行
**支持Debian/Ubuntu/Deepin不支持CentOS** **支持CentOS/Debian/Ubuntu/Deepin**
CentOS
```bash
yum install wget&&wget -O Nlbench.sh https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/Nlbench.sh && chmod +x Nlbench.sh && ./Nlbench.sh
```
Debian/Ubuntu/Deepin
```bash ```bash
wget -O Nlbench.sh https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/Nlbench.sh && chmod +x Nlbench.sh && ./Nlbench.sh wget -O Nlbench.sh https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/Nlbench.sh && chmod +x Nlbench.sh && ./Nlbench.sh
``` ```

View File

@ -14,3 +14,4 @@
# 2024-07-29 v1.0.9 - 增加依赖安装 # 2024-07-29 v1.0.9 - 增加依赖安装
# 2024-07-31 v1.1.0 - 去除yabs的gb6测试替换iperf3服务端vps # 2024-07-31 v1.1.0 - 去除yabs的gb6测试替换iperf3服务端vps
# 2024-08-08 v1.1.1 - 去除回程路由的ip等信息。 # 2024-08-08 v1.1.1 - 去除回程路由的ip等信息。
# 2024-08-13 v1.1.2 - 优化tab标签。