Files
hzhub/hzhub-ai/start.sh
大壮 278e507e8a feat: 添加员工门户项目及相关后端改造
- 新增 hzhub-portal-employee 员工门户前端项目(基于 Vue3 + Element Plus)
- 后端登录接口增加返回 nickName 字段
- 移除 KnowledgeInfoController 的 @SaCheckPermission 注解
- 删除 hzhub-portal-company 旧门户项目
- 更新项目文档和架构说明
- 添加后台运行管理脚本(start-all.sh / status-all.sh / stop-all.sh)
- 更新 docker-compose 配置

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 03:47:33 +00:00

59 lines
1.7 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.
#!/bin/bash
# HZHub AI 后端服务启动脚本
# 功能:后台启动 hzhub-ai Spring Boot 服务
# 注意:实际启动的是 hzhub-admin 子模块
PROJECT_NAME="hzhub-ai"
PROJECT_DIR="$(cd "$(dirname "$0")" && pwd)"
PID_FILE="$PROJECT_DIR/.pid"
LOG_FILE="$PROJECT_DIR/logs/backend.log"
# 创建日志目录
mkdir -p "$PROJECT_DIR/logs"
echo "========================================="
echo "启动 $PROJECT_NAME 后端服务"
echo "========================================="
# 检查是否已经在运行
if [ -f "$PID_FILE" ]; then
PID=$(cat "$PID_FILE")
if ps -p "$PID" > /dev/null 2>&1; then
echo "⚠️ 服务已在运行中 (PID: $PID)"
echo "如需重启,请先执行 ./stop.sh"
exit 1
else
echo "清理无效的PID文件"
rm -f "$PID_FILE"
fi
fi
# 启动服务
echo "🚀 启动 Spring Boot 服务..."
cd "$PROJECT_DIR/hzhub-admin"
# 使用nohup后台运行Maven Spring Boot
nohup mvn spring-boot:run -Dspring-boot.run.profiles=dev > "$LOG_FILE" 2>&1 &
PID=$!
# 等待更长时间检查进程是否成功启动Spring Boot启动较慢
echo "⏳ 等待服务启动中..."
sleep 5
if ps -p "$PID" > /dev/null 2>&1; then
echo "$PID" > "$PID_FILE"
echo "✅ 服务启动成功"
echo " PID: $PID"
echo " 日志: $LOG_FILE"
echo " API: http://localhost:6039"
echo ""
echo "查看日志: tail -f $LOG_FILE"
echo "查看状态: ./status.sh"
echo ""
echo "💡 提示: Spring Boot 完整启动需要30-60秒"
echo " 请执行 ./logs.sh 或 tail -f $LOG_FILE 查看启动进度"
else
echo "❌ 服务启动失败"
echo "请查看日志: $LOG_FILE"
exit 1
fi