From 26e3fd435decb12ced1fb551ea0d02292208c24e Mon Sep 17 00:00:00 2001 From: hotyue <52734432+hotyue@users.noreply.github.com> Date: Sun, 12 Apr 2026 04:36:52 +0000 Subject: [PATCH] =?UTF-8?q?chore(core/uninstall):=20=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E6=97=A0=E7=97=95=E7=84=A6=E5=9C=9F=E5=8D=B8=E8=BD=BD=E7=AD=96?= =?UTF-8?q?=E7=95=A5=EF=BC=8C=E5=BC=95=E5=85=A5=20pkill=20=E8=AF=AD?= =?UTF-8?q?=E6=B3=95=E5=B9=B6=E5=BD=BB=E5=BA=95=E6=8A=B9=E9=99=A4=20/tmp?= =?UTF-8?q?=20=E7=B3=BB=E7=BB=9F=E7=BC=93=E5=AD=98=E7=A2=8E=E5=B1=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/uninstall.sh | 51 ++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/core/uninstall.sh b/core/uninstall.sh index f7b9b49..b77da92 100755 --- a/core/uninstall.sh +++ b/core/uninstall.sh @@ -1,48 +1,49 @@ #!/bin/bash # ========================================================== -# 脚本名称: uninstall.sh (IP-Sentinel 一键卸载脚本 V2.0) -# 核心功能: 清除所有世代的守护进程、清理系统定时任务、删除程序文件 +# 脚本名称: uninstall.sh (IP-Sentinel 一键卸载脚本 V3.1.4 焦土版) +# 核心功能: 无痕清理守护进程、定时任务、运行目录及临时缓存 # ========================================================== INSTALL_DIR="/opt/ip_sentinel" echo "========================================================" -echo " 🗑️ 准备卸载 IP-Sentinel (VPS IP 自动养护哨兵)" +echo " 🗑️ 准备卸载 IP-Sentinel (边缘节点 Edge Agent)" echo "========================================================" -# 1. 停止运行中的守护进程与主控模块 (涵盖 V1.0 至 V2.0 架构全量进程) +# 1. 停止运行中的守护进程与主控模块 (涵盖所有历史版本进程) echo "[1/3] 正在终止后台守护进程与所有养护任务..." -# 击杀旧版 (V1.x) 遗留进程 -pgrep -f tg_daemon.sh | xargs -r kill -9 >/dev/null 2>&1 - -# 击杀新版 (V2.x) 神经末梢守护进程 -pgrep -f agent_daemon.sh | xargs -r kill -9 >/dev/null 2>&1 -pgrep -f webhook.py | xargs -r kill -9 >/dev/null 2>&1 - -# 击杀调度引擎与更新/战报模块 -pgrep -f runner.sh | xargs -r kill -9 >/dev/null 2>&1 -pgrep -f updater.sh | xargs -r kill -9 >/dev/null 2>&1 -pgrep -f tg_report.sh | xargs -r kill -9 >/dev/null 2>&1 - -# 击杀所有具体的业务执行模块 -pgrep -f mod_google.sh | xargs -r kill -9 >/dev/null 2>&1 -pgrep -f mod_trust.sh | xargs -r kill -9 >/dev/null 2>&1 +# 使用 pkill 替代传统的 pgrep | xargs,指令更短、容错率更高 +pkill -9 -f "tg_daemon.sh" >/dev/null 2>&1 +pkill -9 -f "agent_daemon.sh" >/dev/null 2>&1 +pkill -9 -f "webhook.py" >/dev/null 2>&1 +pkill -9 -f "runner.sh" >/dev/null 2>&1 +pkill -9 -f "updater.sh" >/dev/null 2>&1 +pkill -9 -f "tg_report.sh" >/dev/null 2>&1 +pkill -9 -f "mod_google.sh" >/dev/null 2>&1 +pkill -9 -f "mod_trust.sh" >/dev/null 2>&1 # 2. 清除系统定时任务 (Cron) echo "[2/3] 正在清理系统定时任务 (Cron)..." -crontab -l 2>/dev/null | grep -v "ip_sentinel" > /tmp/cron_backup -crontab /tmp/cron_backup -rm -f /tmp/cron_backup +if crontab -l >/dev/null 2>&1; then + crontab -l | grep -v "ip_sentinel" > /tmp/cron_backup + crontab /tmp/cron_backup + rm -f /tmp/cron_backup +fi -# 3. 删除所有文件与日志 -echo "[3/3] 正在抹除核心程序、配置文件与系统日志..." +# 3. 删除所有文件、日志与临时缓存 +echo "[3/3] 正在抹除核心程序、配置文件与系统痕迹..." if [ -d "$INSTALL_DIR" ]; then rm -rf "$INSTALL_DIR" fi +# 拔除 /tmp 目录下的所有更新下载临时文件和 V1/V2 遗留的偏移量记录 +rm -f /tmp/ip_sentinel_*.txt +rm -f /tmp/ip_sentinel_*.json + echo "========================================================" echo "✅ 卸载彻底完成!IP-Sentinel 已从您的系统中无痕移除。" -echo "👋 感谢您的使用,期待未来再次为您守护 IP!" +echo "💡 提示:如果安装时在防火墙放行了 Webhook 随机端口,请您按需手动关闭。" +echo "👋 感谢您的使用,期待未来再次为您守护资产!" echo "========================================================" \ No newline at end of file