#!/bin/bash # 健康检查脚本 echo "🔍 DMP 服务健康检查" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "" # 检查进程 echo "📋 进程状态:" if pgrep -f "node server.js" > /dev/null; then SERVER_PID=$(pgrep -f "node server.js") echo " ✅ Node.js 服务器运行中 (PID: $SERVER_PID)" else echo " ❌ Node.js 服务器未运行" fi if pgrep -f "cloudflared tunnel.*dmp-tunnel" > /dev/null; then TUNNEL_PID=$(pgrep -f "cloudflared tunnel.*dmp-tunnel") echo " ✅ Cloudflare Tunnel 运行中 (PID: $TUNNEL_PID)" else echo " ❌ Cloudflare Tunnel 未运行" fi echo "" echo "🌐 服务测试:" # 测试本地服务 if curl -s -f http://localhost:3456 > /dev/null 2>&1; then echo " ✅ 本地服务 (http://localhost:3456) 正常" else echo " ❌ 本地服务 (http://localhost:3456) 无法访问" fi # 测试公网访问 HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" https://dmp.ink1ing.tech 2>/dev/null) if [ "$HTTP_CODE" = "200" ]; then echo " ✅ 公网访问 (https://dmp.ink1ing.tech) 正常" elif [ "$HTTP_CODE" = "530" ]; then echo " ⚠️ 公网访问返回 530 - Tunnel 未连接或服务未运行" elif [ "$HTTP_CODE" = "1033" ]; then echo " ⚠️ 公网访问返回 1033 - DNS 配置错误" else echo " ❌ 公网访问失败 (HTTP $HTTP_CODE)" fi echo "" echo "🔗 Tunnel 状态:" cloudflared tunnel info dmp-tunnel 2>&1 | head -5 echo "" echo "📊 DNS 解析:" dig dmp.ink1ing.tech +short echo "" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"