mirror of
https://github.com/everett7623/nodeloc_vps_test.git
synced 2024-12-26 08:15:19 +00:00
Update nodeloc_vps_autotest.sh
This commit is contained in:
parent
dbe1450b26
commit
4ebdc2e145
@ -30,7 +30,7 @@ fi
|
|||||||
|
|
||||||
# 检查并安装依赖
|
# 检查并安装依赖
|
||||||
install_dependencies() {
|
install_dependencies() {
|
||||||
echo -e "${YELLOW}正在检查并安装必要的依赖项...${NC}"
|
echo -e "${YELLOW}正在检查并安装必要的依赖项...${NC}"
|
||||||
|
|
||||||
# 更新包列表
|
# 更新包列表
|
||||||
if ! sudo apt-get update; then
|
if ! sudo apt-get update; then
|
||||||
@ -62,7 +62,6 @@ install_dependencies() {
|
|||||||
|
|
||||||
echo -e "${GREEN}依赖项检查和安装完成。${NC}"
|
echo -e "${GREEN}依赖项检查和安装完成。${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# 统计使用次数
|
# 统计使用次数
|
||||||
sum_run_times() {
|
sum_run_times() {
|
||||||
local COUNT
|
local COUNT
|
||||||
@ -76,7 +75,6 @@ sum_run_times() {
|
|||||||
total_count=0
|
total_count=0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# 检测VPS地理位置
|
# 检测VPS地理位置
|
||||||
detect_region() {
|
detect_region() {
|
||||||
local country
|
local country
|
||||||
@ -96,14 +94,12 @@ detect_region() {
|
|||||||
*) echo "0" ;; # 跨国平台
|
*) echo "0" ;; # 跨国平台
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# 函数:运行命令并捕获输出
|
# 函数:运行命令并捕获输出
|
||||||
run_and_capture() {
|
run_and_capture() {
|
||||||
local output
|
local output
|
||||||
output=$(eval "$1" 2>&1)
|
output=$(eval "$1" 2>&1)
|
||||||
echo "$output"
|
echo "$output"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Markdown输出结果
|
# Markdown输出结果
|
||||||
format_results()
|
format_results()
|
||||||
{
|
{
|
||||||
@ -170,11 +166,9 @@ $autotrace_result
|
|||||||
\`\`\`
|
\`\`\`
|
||||||
[/tab]
|
[/tab]
|
||||||
[/tabs]"
|
[/tabs]"
|
||||||
|
|
||||||
echo "$result" > results.md
|
echo "$result" > results.md
|
||||||
echo -e "${GREEN}结果已保存到 results.md 文件中。${NC}"
|
echo -e "${GREEN}结果已保存到 results.md 文件中。${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# 复制结果到剪贴板
|
# 复制结果到剪贴板
|
||||||
copy_to_clipboard() {
|
copy_to_clipboard() {
|
||||||
if [ -f results.md ]; then
|
if [ -f results.md ]; then
|
||||||
@ -191,9 +185,6 @@ copy_to_clipboard() {
|
|||||||
echo -e "${RED}results.md 文件不存在。${NC}"
|
echo -e "${RED}results.md 文件不存在。${NC}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 输出欢迎信息
|
# 输出欢迎信息
|
||||||
show_welcome() {
|
show_welcome() {
|
||||||
echo ""
|
echo ""
|
||||||
@ -230,7 +221,6 @@ show_welcome() {
|
|||||||
read -n 1 -s
|
read -n 1 -s
|
||||||
clear
|
clear
|
||||||
}
|
}
|
||||||
|
|
||||||
# 运行所有测试
|
# 运行所有测试
|
||||||
run_all_tests() {
|
run_all_tests() {
|
||||||
echo "开始运行测试..."
|
echo "开始运行测试..."
|
||||||
@ -266,7 +256,6 @@ run_all_tests() {
|
|||||||
echo -e "运行${YELLOW}AutoTrace三网回程路由...${NC}"
|
echo -e "运行${YELLOW}AutoTrace三网回程路由...${NC}"
|
||||||
autotrace_result=$(run_and_capture "wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && echo '1' | bash AutoTrace.sh)
|
autotrace_result=$(run_and_capture "wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && echo '1' | bash AutoTrace.sh)
|
||||||
}
|
}
|
||||||
|
|
||||||
# 主函数
|
# 主函数
|
||||||
main() {
|
main() {
|
||||||
install_dependencies
|
install_dependencies
|
||||||
|
Loading…
Reference in New Issue
Block a user