Files
jiedian/scripts/uninstall.sh
T
2026-06-28 00:26:18 +08:00

39 lines
1.2 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# 卸载 jiediansing-box + 管理面板 + nginx 站点)
# 用法:sudo bash scripts/uninstall.sh
set -euo pipefail
[[ $EUID -eq 0 ]] || { echo "请使用 root 运行"; exit 1; }
echo "[*] 停止服务 ..."
systemctl stop jiedian-panel sing-box xray 2>/dev/null || true
systemctl disable jiedian-panel sing-box xray 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 配置 ..."
rm -rf /etc/sing-box
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/install.sh"