-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatus.sh
More file actions
executable file
·111 lines (97 loc) · 3.4 KB
/
status.sh
File metadata and controls
executable file
·111 lines (97 loc) · 3.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
# HeyTeX Status Script
# Shows the status of HeyTeX services
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SERVER_DIR="$SCRIPT_DIR/server"
CLIENT_DIR="$SCRIPT_DIR/client"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "🔍 HeyTeX Status"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
# Check Backend
echo "🔹 Backend Server:"
if pgrep -f "node dist/index.js" > /dev/null; then
BACKEND_PID=$(pgrep -f "node dist/index.js")
BACKEND_UPTIME=$(ps -p $BACKEND_PID -o etime= | tr -d ' ')
BACKEND_MEM=$(ps -p $BACKEND_PID -o rss= | awk '{printf "%.1f MB", $1/1024}')
echo " ✅ Running"
echo " PID: $BACKEND_PID"
echo " Uptime: $BACKEND_UPTIME"
echo " Memory: $BACKEND_MEM"
echo " Port: 5433"
# Test health
if curl -s http://localhost:5433/health > /dev/null 2>&1; then
echo " Health: ✅ Responding"
else
echo " Health: ⚠️ Not responding"
fi
else
echo " ❌ Not running"
fi
echo ""
echo "🔹 Frontend Build:"
if [ -d "$SCRIPT_DIR/dist-deployed" ] && [ -f "$SCRIPT_DIR/dist-deployed/index.html" ]; then
DEPLOY_TIME=$(stat -f "%Sm" -t "%Y-%m-%d %H:%M:%S" "$SCRIPT_DIR/dist-deployed/index.html" 2>/dev/null || echo "Unknown")
echo " ✅ Deployed"
echo " Last: $DEPLOY_TIME"
echo " Path: $SCRIPT_DIR/dist-deployed/"
else
echo " ⚠️ Not deployed"
fi
echo ""
echo "🔹 Nginx:"
if pgrep nginx > /dev/null; then
echo " ✅ Running"
if lsof -i :5436 > /dev/null 2>&1; then
echo " Port: 5436 (listening)"
else
echo " Port: 5436 (not listening)"
fi
else
echo " ❌ Not running"
fi
echo ""
echo "🔹 PostgreSQL:"
if pg_isready -q 2>/dev/null; then
echo " ✅ Running"
PG_VERSION=$(psql --version 2>/dev/null | awk '{print $3}' || echo "Unknown")
echo " Version: $PG_VERSION"
else
echo " ❌ Not running or not configured"
fi
echo ""
echo "🔹 MinIO:"
if pgrep -f minio > /dev/null; then
MINIO_PID=$(pgrep -f minio)
echo " ✅ Running"
echo " PID: $MINIO_PID"
else
echo " ❌ Not running"
fi
echo ""
echo "🔹 Cloudflare Tunnel:"
if pgrep -f "config-heytex.yml" > /dev/null; then
TUNNEL_PID=$(pgrep -f "config-heytex.yml")
TUNNEL_UPTIME=$(ps -p $TUNNEL_PID -o etime= | tr -d ' ')
echo " ✅ Running"
echo " PID: $TUNNEL_PID"
echo " Uptime: $TUNNEL_UPTIME"
echo " Config: ~/.cloudflared/config-heytex.yml"
else
echo " ❌ Not running"
fi
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "🌐 URLs:"
echo " Backend: http://localhost:5433"
echo " Frontend: https://heytex.truyenthong.edu.vn"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
# Show recent logs if backend is running
if pgrep -f "node dist/index.js" > /dev/null; then
echo "📝 Recent Backend Logs (last 10 lines):"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
tail -10 "$SERVER_DIR/nohup.out" 2>/dev/null || echo " No logs available"
echo ""
fi