From 252ddadddbd35e9b8c3c2b29c454cf4d69d126a0 Mon Sep 17 00:00:00 2001 From: chunzhi Date: Thu, 8 Feb 2024 14:26:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20choose-cn-v2.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- choose-cn-v2.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/choose-cn-v2.sh b/choose-cn-v2.sh index e2ebc54..b4e250c 100644 --- a/choose-cn-v2.sh +++ b/choose-cn-v2.sh @@ -1,5 +1,21 @@ #!/bin/bash +# 检查并安装依赖项 jq 和 bc +if ! command -v jq &> /dev/null +then + echo "jq could not be found, installing now..." + sudo apt-get update && sudo apt-get install -y jq +fi + +if ! command -v bc &> /dev/null +then + echo "bc could not be found, installing now..." + sudo apt-get update && sudo apt-get install -y bc +fi + +# 输出设置 crontab 的命令 +echo "To run this script every day at 3 AM, add the following line to your crontab:" +echo "0 3 * * * /path/to/this/script.sh" # 测速脚本部分 # 使用 dig 命令查询 DNS 记录并写入 ip.txt dig cf.youoffer.net A +short > ip.txt