SuperAPI AI 工具集

uninstall-watchdog

部署与运维

查看项目

更新于 10-15 18:45

技能介绍

用途:移除 egregore watchdog 守护进程,并清理由 install-watchdog 技能创建的所有文件。卸载后,egregore 会话不再自动重新启动。

使用场景:不再需要自动重新启动时;在从项目中移除 egregore 插件之前;从守护进程模式切换到手动调用时。不适用于从未安装过 watchdog 的情况,需先用验证命令确认。

主要步骤:

  1. 检测操作系统:OS=$(uname -s)
  2. 停止并移除服务。macOS(launchd):PLIST=~/Library/LaunchAgents/com.egregore.watchdog.plist;执行 launchctl unload "$PLIST" 2>/dev/null;再执行 rm -f "$PLIST"。Linux(systemd):执行 systemctl --user stop egregore-watchdog.timer 2>/dev/null;systemctl --user disable egregore-watchdog.timer 2>/dev/null;rm -f ~/.config/systemd/user/egregore-watchdog.timer;rm -f ~/.config/systemd/user/egregore-watchdog.service;systemctl --user daemon-reload。
  3. 清理关联文件:rm -f ~/.egregore/watchdog.pid;rm -f ~/.egregore/watchdog.log。
  4. 确认移除。macOS:launchctl list | grep egregore 应无输出。Linux:systemctl --user list-timers | grep egregore 应无输出。

移除的文件:macOS 的 launchd 代理定义 ~/Library/LaunchAgents/com.egregore.watchdog.plist;Linux 的 systemd 定时器单元 ~/.config/systemd/user/egregore-watchdog.timer 与服务单元 egregore-watchdog.service;两平台的 PID 文件 ~/.egregore/watchdog.pid;macOS 的日志 ~/.egregore/watchdog.log。

完成标准:卸载完成后对应 plist 或 systemd 单元不存在;验证命令无输出;pid 与日志文件被移除或本就不存在;通知用户 watchdog 已移除、自动重新启动已禁用。

限制:仅涉及上述文件与服务的移除,具体安装前提、权限要求及异常处理暂未提供。