From 55f7ee0c8cc51990cf5f374424b80a5a2bf1151d Mon Sep 17 00:00:00 2001 From: hotyue <52734432+hotyue@users.noreply.github.com> Date: Mon, 27 Apr 2026 02:05:24 +0000 Subject: [PATCH] =?UTF-8?q?feat(core):=20=E5=8D=87=E7=BA=A7=E8=88=B0?= =?UTF-8?q?=E9=98=9F=E5=B7=A1=E9=80=BB=E5=AF=86=E5=BA=A6=EF=BC=8C=E5=B0=86?= =?UTF-8?q?=E5=85=A8=E5=B1=80=E5=85=BB=E6=8A=A4=E9=A2=91=E7=8E=87=E7=94=B1?= =?UTF-8?q?=2030=20=E5=88=86=E9=92=9F=E7=BC=A9=E7=9F=AD=E8=87=B3=2020=20?= =?UTF-8?q?=E5=88=86=E9=92=9F=20(=E6=AF=8F=E6=97=A5=2072=20=E6=AC=A1)=20?= =?UTF-8?q?=E5=B9=B6=E5=AF=B9=E9=BD=90=E6=89=80=E6=9C=89=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E4=B8=8E=E6=88=98=E6=8A=A5=E6=A0=87=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/install.sh | 12 +++++++----- core/runner.sh | 2 +- core/tg_report.sh | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/core/install.sh b/core/install.sh index e28de0c..7b65f1c 100755 --- a/core/install.sh +++ b/core/install.sh @@ -696,8 +696,8 @@ EOF [Unit] Description=Timer for IP-Sentinel Runner Service [Timer] -# [修复] 彻底剔除 OnActiveSec=10s,改用严格的日历整点/半点匹配,杜绝 OTA 瞬间的并发走火! -OnCalendar=*:00/30 +# [频率优化] 改用严格的 20 分钟步进,杜绝 OTA 瞬间的并发走火! +OnCalendar=*:0/20 RandomizedDelaySec=180 Persistent=true Unit=ip-sentinel-runner.service @@ -822,7 +822,8 @@ while true; do # 强制获取绝对 UTC 时分,免疫系统错误时区 MIN=\$(date -u +%M) HOUR=\$(date -u +%H) - if [ "\$MIN" == "00" ] || [ "\$MIN" == "30" ]; then + # [频率优化] 匹配 20 分钟步进 (00, 20, 40) + if [ "\$MIN" == "00" ] || [ "\$MIN" == "20" ] || [ "\$MIN" == "40" ]; then /bin/bash /opt/ip_sentinel/core/runner.sh >/dev/null 2>&1 fi # [绝对 UTC 锚点] 基于部署时刻的锚点触发热数据更新,天然并发削峰 @@ -860,7 +861,8 @@ EOF # 🟢 走常规调度路线 (正常的 Linux 或 KVM 型 Alpine) # ========================================== crontab -l 2>/dev/null | grep -v "ip_sentinel" > /tmp/cron_backup || true - echo "*/30 * * * * ${INSTALL_DIR}/core/runner.sh >/dev/null 2>&1" >> /tmp/cron_backup + # [频率优化] 调整为 */20 + echo "*/20 * * * * ${INSTALL_DIR}/core/runner.sh >/dev/null 2>&1" >> /tmp/cron_backup # [绝对 UTC 锚点] 每天精确在部署的 UTC 时刻触发 echo "${DEPLOY_UTC_MIN} ${DEPLOY_UTC_HOUR} * * * ${INSTALL_DIR}/core/updater.sh >/dev/null 2>&1" >> /tmp/cron_backup @@ -982,7 +984,7 @@ else echo "🎉 边缘节点 (Agent) 部署流程彻底完成!" fi echo "📍 你的本地守护区域已锁定为: $REGION_NAME" -echo "⚙️ 哨兵现已开启 [每30分钟] 的高频高拟真养护循环。" +echo "⚙️ 哨兵现已开启 [每20分钟] 的高频高拟真养护循环。" if [[ -n "$TG_TOKEN" ]]; then echo "📡 Webhook 监听已启动 (端口: $AGENT_PORT) 并向中枢发送了注册请求。" diff --git a/core/runner.sh b/core/runner.sh index 828d7be..798958d 100755 --- a/core/runner.sh +++ b/core/runner.sh @@ -50,7 +50,7 @@ export -f log export CONFIG_FILE INSTALL_DIR # 3. 防僵尸网络特征 (Cron Jitter) - 核心隐蔽逻辑 -# 配合每 30 分钟的调度周期,将随机休眠控制在 0 到 180 秒内,彻底打散全球并发请求 +# 配合每 20 分钟的调度周期,将随机休眠控制在 0 到 180 秒内,彻底打散全球并发请求 if [ -t 1 ]; then log "SYSTEM" "INFO " "💻 检测到人工终端干预,跳过静默休眠,立即执行任务!" else diff --git a/core/tg_report.sh b/core/tg_report.sh index 9baeab5..fb2fd8c 100755 --- a/core/tg_report.sh +++ b/core/tg_report.sh @@ -96,7 +96,7 @@ case "$REGION_CODE" in *) FLAG="🌐" ;; esac -# 3. 截取过去 24 小时的日志 (每天48次轮询,保留最新 1000 行足以覆盖单日战报) +# 3. 截取过去 24 小时的日志 (每天72次轮询,保留最新 1000 行足以覆盖单日战报) LOG_CONTENT=$(tail -n 1000 "$LOG_FILE" 2>/dev/null) if [ -z "$LOG_CONTENT" ]; then