#!/bin/bash
# hzhub-system 状态脚本

cd "$(dirname "$0")"

PID_FILE="logs/system.pid"

if [ -f "$PID_FILE" ]; then
  PID=$(cat "$PID_FILE")
  if kill -0 "$PID" 2>/dev/null; then
    echo "========================================="
    echo " hzhub-system 状态"
    echo "========================================="
    echo "状态: 运行中"
    echo "PID:  $PID"
    echo "端口: 8083"
    echo "API:  http://localhost:8083"
    echo "文档: http://localhost:8083/system/api-docs"
    echo "功能: 认证/系统管理/审批工作流/代码生成"
    echo "========================================="
    exit 0
  fi
fi

PIDS=$(pgrep -f "hzhub-system\|HZHubSystemApplication" 2>/dev/null)
if [ -n "$PIDS" ]; then
  echo "hzhub-system is running. (PID: $PIDS)"
else
  echo "hzhub-system is not running."
fi
