From 9904246e45f7a5f89eb079c4c651f808bc3acb52 Mon Sep 17 00:00:00 2001 From: hotyue <52734432+hotyue@users.noreply.github.com> Date: Sat, 11 Apr 2026 05:31:52 +0000 Subject: [PATCH] =?UTF-8?q?feat(core):=20=E4=BC=98=E5=8C=96=20Agent=20?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E9=80=BB=E8=BE=91=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E9=83=A8=E7=BD=B2=E5=89=8D=E7=8E=AF=E5=A2=83=E8=87=AA=E6=B4=81?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=20(=E8=87=AA=E5=8A=A8=E6=B8=85=E7=90=86?= =?UTF-8?q?=E5=83=B5=E5=B0=B8=E8=BF=9B=E7=A8=8B=E4=B8=8E=E5=86=97=E4=BD=99?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/install.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/core/install.sh b/core/install.sh index 7f630071..377e7b07 100755 --- a/core/install.sh +++ b/core/install.sh @@ -51,6 +51,27 @@ if [ "$ACTION_CHOICE" == "2" ]; then exit 0 fi +# ================== [v3.1.1 新增: 安装前环境纯净度清理 (严格保留日志)] ================== +echo -e "\n⏳ 正在清理旧版守护进程与冗余任务 (保留历史日志)..." +# 1. 强制超度可能存活的 Webhook 及各类看门狗进程,释放端口 +pkill -9 -f "webhook.py" >/dev/null 2>&1 || true +pkill -9 -f "agent_daemon.sh" >/dev/null 2>&1 || true +pkill -9 -f "runner.sh" >/dev/null 2>&1 || true + +# 2. 清除系统定时任务 (Cron) 中的旧版条目 +if crontab -l >/dev/null 2>&1; then + crontab -l | grep -v "ip_sentinel" > /tmp/cron_clean + crontab /tmp/cron_clean + rm -f /tmp/cron_clean +fi + +# 3. 抹除旧版核心代码与配置文件,杜绝代码冲突 (精准避开 logs 目录) +if [ -d "$INSTALL_DIR" ]; then + rm -rf "${INSTALL_DIR}/core" "${INSTALL_DIR}/data" "${INSTALL_DIR}/config.conf" "${INSTALL_DIR}/.last_ip" 2>/dev/null +fi +echo -e "\033[32m✅ 环境清理完毕,幽灵进程已肃清!\033[0m" +# ======================================================================================== + # 📍 动态一级菜单:国家选择 echo -e "\n\033[36m📍 【第一级】请选择目标国家/地区:\033[0m" jq -r '.countries[] | "\(.id)|\(.name)|\(.keyword_file)"' /tmp/map.json > /tmp/countries.txt