-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhealthcheck.sh
More file actions
52 lines (44 loc) · 1.31 KB
/
healthcheck.sh
File metadata and controls
52 lines (44 loc) · 1.31 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
#!/bin/bash
# Health check script for LiveboxMonitor container
# Validates that the application is running and accessible
set -e
# Colors for output
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo "=== LiveboxMonitor Health Check ==="
# Check 1: Verify the HTTP server is listening on port 3000
echo -n "Checking HTTP server (port 3000)... "
if timeout 5 bash -c "echo > /dev/tcp/localhost/3000" 2>/dev/null; then
echo -e "${GREEN}✓${NC}"
else
echo -e "${RED}✗${NC}"
exit 1
fi
# Check 2: Verify HTTP response from web interface
echo -n "Checking HTTP response (port 3000)... "
if curl -u "$CUSTOM_USER:$PASSWORD" -sf http://localhost:3000/ > /dev/null 2>&1; then
echo -e "${GREEN}✓${NC}"
else
echo -e "${RED}✗${NC}"
exit 1
fi
# Check 3: Verify Python process is running
echo -n "Checking LiveboxMonitor process... "
if pgrep -f "python.*LiveboxMonitor" > /dev/null; then
echo -e "${GREEN}✓${NC}"
else
echo -e "${RED}✗${NC}"
exit 1
fi
# Check 4: Verify config and key files were created
echo -n "Checking configuration files... "
if [ -f "/config/LiveboxMonitor/Config.txt" ] && [ -f "/config/LiveboxMonitor/Key.txt" ]; then
echo -e "${GREEN}✓${NC}"
else
echo -e "${RED}✗${NC}"
exit 1
fi
echo ""
echo -e "${GREEN}All health checks passed!${NC}"
exit 0