Files
gpf_pet_hospital/start_frp.sh

69 lines
2.1 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.

#!/bin/bash
# 宠物医院管理系统 - FRP内网穿透启动脚本
echo "==========================================="
echo " 宠物医院管理系统 - FRP内网穿透启动脚本"
echo "==========================================="
# 检查frpc是否存在
if [ ! -f "./frp/frpc" ]; then
echo "错误: 未找到frpc客户端程序"
echo "请先按照frp_setup_guide.md中的说明下载并安装frpc"
echo ""
echo "快速安装命令:"
echo "cd /mnt/d/bs/gpf_pet_hospital"
echo "wget https://github.com/fatedier/frp/releases/download/v0.66.0/frp_0.66.0_linux_amd64.tar.gz"
echo "tar -xzf frp_0.66.0_linux_amd64.tar.gz"
echo "mv frp_0.66.0_linux_amd64/frpc frp/"
echo "rm -rf frp_0.66.0_linux_amd64 frp_0.66.0_linux_amd64.tar.gz"
exit 1
fi
# 检查配置文件是否存在
if [ ! -f "./frp/frpc.ini" ]; then
echo "错误: 未找到frpc配置文件"
echo "请确保 ./frp/frpc.ini 存在"
exit 1
fi
echo "检查本地服务状态..."
# 检查前端服务
if netstat -tuln | grep -q ":5173 "; then
echo "✓ 前端服务 (Vue) 正在运行"
else
echo "✗ 前端服务 (Vue) 未检测到,请确保已启动: npx vite --host 0.0.0.0 --port 5173"
fi
# 检查后端服务
if netstat -tuln | grep -q ":8081 "; then
echo "✓ 后端服务 (Spring Boot) 正在运行"
else
echo "✗ 后端服务 (Spring Boot) 未检测到,请确保已启动: cd backend && mvn spring-boot:run"
fi
echo ""
echo "启动FRP客户端..."
echo "注意: 请确保FRP服务器端已在公网服务器上启动"
# 启动frpc
cd ./frp
chmod +x frpc
./frpc -c frpc.ini &
FRP_PID=$!
echo "FRP客户端已启动 (PID: $FRP_PID)"
echo ""
echo "==========================================="
echo " FRP内网穿透已启动"
echo "==========================================="
echo "服务映射:"
echo " 本地:5173 -> 公网:HTTP (通过域名访问)"
echo " 本地:8081 -> 公网:8081 (TCP)"
echo ""
echo "要停止FRP客户端请运行: kill $FRP_PID"
echo "==========================================="
# 显示FRP进程
ps aux | grep frpc | grep -v grep