health-check.sh: only show docker and Syncthing checks on spokes, not hubs

This commit is contained in:
Justin Oros
2026-04-19 22:34:21 -07:00
parent ebb366e4bc
commit a5cf3d1f8b

View File

@@ -36,18 +36,6 @@ fi
check_common() {
header "System"
if command -v docker >/dev/null 2>&1; then
ok "docker installed"
else
fail "docker not found"
fi
if docker info >/dev/null 2>&1; then
ok "docker daemon running"
else
fail "docker daemon not running"
fi
local ssh_svc=""
if systemctl list-unit-files ssh.service >/dev/null 2>&1; then
ssh_svc="ssh"
@@ -65,17 +53,31 @@ check_common() {
warn "Could not detect SSH service"
fi
local st_container
st_container=$(docker ps --format '{{.Names}}' 2>/dev/null | grep -i syncthing | head -1 || true)
if [ -n "$st_container" ]; then
ok "Syncthing container running ($st_container)"
if curl -sf http://127.0.0.1:8384 >/dev/null 2>&1; then
ok "Syncthing API reachable"
if [ "$IS_SPOKE" = true ]; then
if command -v docker >/dev/null 2>&1; then
ok "docker installed"
else
warn "Syncthing container running but API not reachable on :8384"
fail "docker not found"
fi
if docker info >/dev/null 2>&1; then
ok "docker daemon running"
else
fail "docker daemon not running"
fi
local st_container
st_container=$(docker ps --format '{{.Names}}' 2>/dev/null | grep -i syncthing | head -1 || true)
if [ -n "$st_container" ]; then
ok "Syncthing container running ($st_container)"
if curl -sf http://127.0.0.1:8384 >/dev/null 2>&1; then
ok "Syncthing API reachable"
else
warn "Syncthing container running but API not reachable on :8384"
fi
else
warn "No Syncthing container running"
fi
else
warn "No Syncthing container running"
fi
}