mirror of
https://github.com/everett7623/nodeloc_vps_test.git
synced 2025-04-04 14:45:17 +00:00
Compare commits
10 Commits
0071674bc0
...
616ed2bf1c
Author | SHA1 | Date | |
---|---|---|---|
![]() |
616ed2bf1c | ||
![]() |
31ca394378 | ||
![]() |
ebf7e3df30 | ||
![]() |
6dfa75f038 | ||
![]() |
c2fac4dbab | ||
![]() |
8cae62c634 | ||
![]() |
bfb733e2b9 | ||
![]() |
63e0193f36 | ||
![]() |
de83bd263f | ||
![]() |
f4abd4a5ae |
16
Nlbench.sh
16
Nlbench.sh
@ -1,7 +1,7 @@
|
||||
#!/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"
|
||||
VERSION_URL="https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/version.sh"
|
||||
|
||||
@ -427,7 +427,6 @@ run_script() {
|
||||
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"
|
||||
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"
|
||||
;;
|
||||
@ -442,24 +441,25 @@ generate_markdown_output() {
|
||||
local final_output_file="${base_output_file}.md"
|
||||
local sections=("YABS" "Geekbench5" "融合怪" "IP质量" "流媒体" "响应" "多线程测速" "单线程测速" "iperf3" "回程路由")
|
||||
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"
|
||||
|
||||
# 输出有内容的标签
|
||||
for i in "${!sections[@]}"; do
|
||||
section="${sections[$i]}"
|
||||
suffix="${file_suffixes[$i]}"
|
||||
echo "[tab=\"$section\"]" >> "$final_output_file"
|
||||
echo "\`\`\`" >> "$final_output_file"
|
||||
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"
|
||||
echo "\`\`\`" >> "$final_output_file"
|
||||
echo "[/tab]" >> "$final_output_file"
|
||||
rm "${base_output_file}_${suffix}"
|
||||
fi
|
||||
echo "\`\`\`" >> "$final_output_file"
|
||||
echo "[/tab]" >> "$final_output_file"
|
||||
done
|
||||
|
||||
# Adding remaining empty tabs
|
||||
local empty_tabs=("去程路由" "Ping.pe" "哪吒 ICMP" "其他")
|
||||
# 添加保留的空白标签
|
||||
for tab in "${empty_tabs[@]}"; do
|
||||
echo "[tab=\"$tab\"]" >> "$final_output_file"
|
||||
echo "[/tab]" >> "$final_output_file"
|
||||
|
@ -113,10 +113,17 @@ detect_os() {
|
||||
. /etc/lsb-release
|
||||
os_type=$DISTRIB_ID
|
||||
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
|
||||
echo -e "${RED}无法检测操作系统类型和版本。${NC}"
|
||||
return 1
|
||||
os_type=$(uname -s)
|
||||
os_version=$(uname -r)
|
||||
fi
|
||||
os_type=$(echo "$os_type" | tr '[:upper:]' '[:lower:]')
|
||||
echo -e "${YELLOW}检测到的系统: $os_type $os_version${NC}"
|
||||
}
|
||||
|
||||
@ -124,15 +131,14 @@ detect_os() {
|
||||
update_system() {
|
||||
detect_os || return 1
|
||||
|
||||
# 根据操作系统类型选择更新命令
|
||||
case "${os_type,,}" in
|
||||
ubuntu|debian|linuxmint|elementary|pop)
|
||||
update_cmd="apt-get update"
|
||||
upgrade_cmd="apt-get upgrade -y"
|
||||
install_cmd="apt-get install -y"
|
||||
;;
|
||||
fedora|centos|rhel|ol|rocky|almalinux)
|
||||
if [ "${os_version%%.*}" -ge 22 ] || [ "${os_version%%.*}" -ge 8 ]; then
|
||||
centos|rhel|fedora|rocky|almalinux|openeuler)
|
||||
if command -v dnf &>/dev/null; then
|
||||
update_cmd="dnf check-update"
|
||||
upgrade_cmd="dnf upgrade -y"
|
||||
install_cmd="dnf install -y"
|
||||
@ -157,6 +163,16 @@ update_system() {
|
||||
upgrade_cmd="apk upgrade"
|
||||
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}"
|
||||
return 1
|
||||
@ -189,16 +205,32 @@ install_dependencies() {
|
||||
# 安装依赖
|
||||
local dependencies=("curl" "wget" "iperf3")
|
||||
|
||||
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
|
||||
case "${os_type,,}" in
|
||||
gentoo)
|
||||
for dep in "${dependencies[@]}"; do
|
||||
if ! emerge -p $dep &>/dev/null; then
|
||||
echo -e "${YELLOW}正在安装 $dep...${NC}"
|
||||
if ! sudo emerge $dep; then
|
||||
echo -e "${RED}无法安装 $dep。请手动安装此依赖项。${NC}"
|
||||
fi
|
||||
else
|
||||
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}"
|
||||
clear
|
||||
@ -298,7 +330,7 @@ run_script() {
|
||||
# YABS
|
||||
1)
|
||||
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/\.\.\./\.\.\.\n/g' "$temp_file"
|
||||
sed -i '/\.\.\./d' "$temp_file"
|
||||
@ -348,7 +380,7 @@ run_script() {
|
||||
# IP质量
|
||||
4)
|
||||
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 -r 's/(⠋|⠙|⠹|⠸|⠼|⠴|⠦|⠧|⠇|⠏)/\n/g' "$temp_file"
|
||||
sed -i -r '/正在检测/d' "$temp_file"
|
||||
@ -427,7 +459,7 @@ run_script() {
|
||||
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"
|
||||
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"
|
||||
;;
|
||||
esac
|
||||
@ -441,24 +473,25 @@ generate_markdown_output() {
|
||||
local final_output_file="${base_output_file}.md"
|
||||
local sections=("YABS" "Geekbench5" "融合怪" "IP质量" "流媒体" "响应" "多线程测速" "单线程测速" "iperf3" "回程路由")
|
||||
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"
|
||||
|
||||
# 输出有内容的标签
|
||||
for i in "${!sections[@]}"; do
|
||||
section="${sections[$i]}"
|
||||
suffix="${file_suffixes[$i]}"
|
||||
echo "[tab=\"$section\"]" >> "$final_output_file"
|
||||
echo "\`\`\`" >> "$final_output_file"
|
||||
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"
|
||||
echo "\`\`\`" >> "$final_output_file"
|
||||
echo "[/tab]" >> "$final_output_file"
|
||||
rm "${base_output_file}_${suffix}"
|
||||
fi
|
||||
echo "\`\`\`" >> "$final_output_file"
|
||||
echo "[/tab]" >> "$final_output_file"
|
||||
done
|
||||
|
||||
# Adding remaining empty tabs
|
||||
local empty_tabs=("去程路由" "Ping.pe" "哪吒 ICMP" "其他")
|
||||
# 添加保留的空白标签
|
||||
for tab in "${empty_tabs[@]}"; do
|
||||
echo "[tab=\"$tab\"]" >> "$final_output_file"
|
||||
echo "[/tab]" >> "$final_output_file"
|
||||
@ -471,6 +504,7 @@ generate_markdown_output() {
|
||||
clear
|
||||
}
|
||||
|
||||
|
||||
# 执行全部脚本
|
||||
run_all_scripts() {
|
||||
local base_output_file="NLvps_results_$(date +%Y%m%d_%H%M%S)"
|
||||
|
@ -11,7 +11,13 @@
|
||||
### 使用方法
|
||||
确保用户为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
|
||||
wget -O Nlbench.sh https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/Nlbench.sh && chmod +x Nlbench.sh && ./Nlbench.sh
|
||||
```
|
||||
|
@ -14,3 +14,4 @@
|
||||
# 2024-07-29 v1.0.9 - 增加依赖安装
|
||||
# 2024-07-31 v1.1.0 - 去除yabs的gb6测试,替换iperf3服务端vps
|
||||
# 2024-08-08 v1.1.1 - 去除回程路由的ip等信息。
|
||||
# 2024-08-13 v1.1.2 - 优化tab标签。
|
||||
|
Loading…
Reference in New Issue
Block a user