-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver-status.sh
More file actions
executable file
·84 lines (68 loc) · 2.1 KB
/
server-status.sh
File metadata and controls
executable file
·84 lines (68 loc) · 2.1 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
#!/bin/bash
# Soulfield OS Server Status Script
PID_FILE="/tmp/soulfield-server.pid"
LOG_FILE="/tmp/soulfield-server.log"
PORT=8790
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
echo -e "${BLUE}=====================================${NC}"
echo -e "${BLUE} Soulfield OS Server Status${NC}"
echo -e "${BLUE}=====================================${NC}"
echo ""
# Check PID file
if [ -f "$PID_FILE" ]; then
PID=$(cat "$PID_FILE")
echo -e "${YELLOW}PID file:${NC} $PID_FILE"
echo -e "${YELLOW}PID:${NC} $PID"
if ps -p $PID > /dev/null 2>&1; then
echo -e "${GREEN}✓ Process is running${NC}"
else
echo -e "${RED}✗ Process not running (stale PID file)${NC}"
fi
else
echo -e "${YELLOW}⚠ No PID file found${NC}"
fi
echo ""
# Check for any Soulfield processes
echo -e "${YELLOW}Active Soulfield processes:${NC}"
PIDS=$(pgrep -f "node backend/index.cjs" 2>/dev/null || true)
if [ -n "$PIDS" ]; then
echo "$PIDS" | while read pid; do
echo -e " ${GREEN}✓ PID: $pid${NC}"
ps -p $pid -o pid,ppid,etime,cmd 2>/dev/null | tail -1
done
else
echo -e " ${RED}✗ No processes found${NC}"
fi
echo ""
# Check port
echo -e "${YELLOW}Port ${PORT} status:${NC}"
PORT_PIDS=$(lsof -ti :${PORT} 2>/dev/null || true)
if [ -n "$PORT_PIDS" ]; then
echo -e " ${GREEN}✓ Port in use by PID(s): ${PORT_PIDS}${NC}"
else
echo -e " ${RED}✗ Port not in use${NC}"
fi
echo ""
# Test health endpoint
echo -e "${YELLOW}Health check:${NC}"
if curl -s -f http://localhost:${PORT}/health > /dev/null 2>&1; then
HEALTH=$(curl -s http://localhost:${PORT}/health)
echo -e " ${GREEN}✓ Server responding${NC}"
echo -e " Response: ${HEALTH}"
else
echo -e " ${RED}✗ Server not responding${NC}"
fi
echo ""
# Show recent logs
echo -e "${YELLOW}Recent logs (last 10 lines):${NC}"
echo -e "${BLUE}-----------------------------------${NC}"
tail -10 "$LOG_FILE" 2>/dev/null || echo "(No logs found)"
echo -e "${BLUE}-----------------------------------${NC}"
echo ""
echo -e "${YELLOW}Full logs:${NC} tail -f $LOG_FILE"
echo ""