Files
opsx-vpn/scripts/uninstall.sh
T
opsx-tools a14d9e62e6 feat: 日志中心 + GRE协议支持 + 流量监控 + 部署脚本
- 新增日志中心功能 (api/logapi.go + Logs.vue)
- 新增GRE协议服务支持 (service/gre/)
- 新增流量监控组件 (TrafficChart.vue)
- 新增L2TP/IPSec测试用例
- 新增日志轮转服务 (logrotate.go)
- 新增部署脚本 (scripts/install.sh, uninstall.sh, service文件)
- 更新i18n国际化文件
- 优化后端API和前端路由
2026-07-25 08:50:34 +08:00

79 lines
2.0 KiB
Bash
Executable File
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
# OPSX VPN 管理平台 —— 卸载脚本
set -euo pipefail
APP_NAME="opsx-vpn"
INSTALL_DIR="/opt/${APP_NAME}"
CONFIG_DIR="/etc/${APP_NAME}"
SERVICE_FILE="/etc/systemd/system/${APP_NAME}.service"
# 颜色输出
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m'
info() { echo -e "${GREEN}[INFO]${NC} $*"; }
warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }
error() { echo -e "${RED}[ERROR]${NC} $*" >&2; }
# 检查 root 权限
if [[ $EUID -ne 0 ]]; then
error "请使用 root 或 sudo 执行此脚本"
exit 1
fi
echo ""
warn "============================================"
warn " 卸载 OPSX VPN 管理平台"
warn "============================================"
echo ""
# 停止并禁用服务
if systemctl is-active --quiet "${APP_NAME}" 2>/dev/null; then
info "停止服务..."
systemctl stop "${APP_NAME}"
fi
if systemctl is-enabled --quiet "${APP_NAME}" 2>/dev/null; then
info "禁用服务..."
systemctl disable "${APP_NAME}"
fi
# 删除 systemd 服务文件
if [[ -f "${SERVICE_FILE}" ]]; then
info "删除 systemd 服务文件..."
rm -f "${SERVICE_FILE}"
systemctl daemon-reload
fi
# 询问是否删除数据
REMOVE_DATA=""
echo ""
read -p "是否删除安装目录 ${INSTALL_DIR}?[y/N] " -r REMOVE_DATA
if [[ "${REMOVE_DATA}" =~ ^[Yy]$ ]]; then
info "删除安装目录: ${INSTALL_DIR}"
rm -rf "${INSTALL_DIR}"
else
info "保留安装目录: ${INSTALL_DIR}"
fi
REMOVE_CONFIG=""
read -p "是否删除配置目录 ${CONFIG_DIR}?[y/N] " -r REMOVE_CONFIG
if [[ "${REMOVE_CONFIG}" =~ ^[Yy]$ ]]; then
info "删除配置目录: ${CONFIG_DIR}"
rm -rf "${CONFIG_DIR}"
else
info "保留配置目录: ${CONFIG_DIR}"
fi
echo ""
info "============================================"
info " OPSX VPN 管理平台已卸载"
info "============================================"
info ""
info " 残留文件(如未删除):"
info " 安装目录: ${INSTALL_DIR}"
info " 配置目录: ${CONFIG_DIR}"
info "============================================"