Files
goalfylearning-admin/scripts/status.sh

65 lines
1.9 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
# 设置颜色输出
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
echo -e "${CYAN}=== Goalfymax Admin 服务状态 ===${NC}"
echo
# 检查进程状态
if [ -f "admin-server.pid" ]; then
PID=$(cat admin-server.pid)
if ps -p $PID > /dev/null 2>&1; then
echo -e "${GREEN}✓ 服务运行中${NC}"
echo -e " 进程ID: $PID"
echo -e " 端口: 8087"
else
echo -e "${RED}✗ 服务未运行PID文件存在但进程不存在${NC}"
fi
else
echo -e "${RED}✗ 服务未运行${NC}"
fi
echo
# 测试健康检查
echo -e "${YELLOW}测试健康检查接口...${NC}"
HEALTH=$(curl -s http://localhost:8087/health 2>/dev/null)
if [ "$HEALTH" = '{"status":"ok"}' ]; then
echo -e "${GREEN}✓ 健康检查通过${NC}"
else
echo -e "${RED}✗ 健康检查失败${NC}"
fi
echo
# 检查数据库连接
echo -e "${YELLOW}检查最近的日志...${NC}"
if [ -f "logs/admin-server.log" ]; then
LAST_ERROR=$(tail -n 100 logs/admin-server.log | grep -i "error\|fatal" | tail -n 1)
if [ -n "$LAST_ERROR" ]; then
echo -e "${RED}✗ 发现错误:${NC}"
echo " $LAST_ERROR"
else
echo -e "${GREEN}✓ 无错误日志${NC}"
fi
else
echo -e "${YELLOW}! 日志文件不存在${NC}"
fi
echo
# 显示API端点
echo -e "${CYAN}可用的API端点:${NC}"
echo -e " 公开接口:"
echo -e " POST http://localhost:8087/api/public/invite-code/apply"
echo -e ""
echo -e " 管理接口(需要认证):"
echo -e " GET http://localhost:8087/api/admin/invite-applications"
echo -e " GET http://localhost:8087/api/admin/invite-applications/statistics"
echo -e " POST http://localhost:8087/api/admin/invite-applications/approve"
echo -e " POST http://localhost:8087/api/admin/invite-applications/reject"
echo
echo -e "${CYAN}=== 状态检查完成 ===${NC}"