#!/usr/bin/env bash # 卸载 jiedian(sing-box + 管理面板 + nginx 站点) # 用法:sudo bash scripts/uninstall.sh set -euo pipefail [[ $EUID -eq 0 ]] || { echo "请使用 root 运行"; exit 1; } echo "[*] 停止服务 ..." systemctl stop jiedian-panel xray sing-box 2>/dev/null || true systemctl disable jiedian-panel xray sing-box 2>/dev/null || true echo "[*] 删除 systemd 单元 ..." rm -f /etc/systemd/system/jiedian-panel.service rm -f /etc/systemd/system/sing-box.service systemctl daemon-reload echo "[*] 删除 sing-box / Xray 配置 ..." rm -rf /etc/sing-box rm -f /usr/local/etc/xray/config.json echo "[*] 删除 nginx 站点 ..." rm -f /etc/nginx/sites-enabled/panel rm -f /etc/nginx/sites-available/panel rm -f /etc/nginx/sites-enabled/acme rm -f /etc/nginx/sites-available/acme rm -f /etc/nginx/sites-enabled/fallback rm -f /etc/nginx/sites-available/fallback nginx -t && systemctl reload nginx 2>/dev/null || true echo "[*] 清理本地数据(保留 .env 与代码)..." ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" rm -rf "${ROOT}/data" rm -rf "${ROOT}/panel/venv" rm -rf "${ROOT}/client/generated" echo "" echo "卸载完成。重新安装:" echo " cd ${ROOT}" echo " bash scripts/generate-keys.sh # 可选,重置 Reality 密钥与面板密码" echo " bash scripts/install.sh"