#!/usr/bin/env bash # Fleet health check: per-team container count vs registry enabled count, # per-team receiver systemd state, and host disk. Read-only, safe to run any time. set -uo pipefail cd /opt/gemastik18-final/panel EXPECTED=$(python3 -c " import sys; sys.path.insert(0,'.') import teams print(len(teams.enabled_challenges())) ") TEAMS=$(ls -d /opt/gemastik18-final/teams/team* 2>/dev/null | sed 's/.*team//' | sort -n) echo "enabled challenges: $EXPECTED" echo "teams: ${TEAMS:-none}" echo for i in $TEAMS; do up=$(docker ps --format '{{.Names}}' | grep -c "_container_team${i}\$" || true) all=$(docker ps -a --format '{{.Names}}' | grep -c "_container_team${i}\$" || true) recv=$(systemctl is-active "gemastik-receiver-team${i}.service" 2>/dev/null || echo none) label=$(python3 -c "import json;print(json.load(open('/opt/gemastik18-final/teams/team${i}/state.json'))['label'])" 2>/dev/null) echo "team${i} (${label}) up=${up}/${EXPECTED} total_ctr=${all} receiver=${recv}" if [ "$up" != "$EXPECTED" ]; then echo " missing: $(python3 - <