#!/usr/bin/env bash # scripts/health.sh — Check health of all services. set -euo pipefail API_URL="${API_URL:-http://localhost:8000}" OLLAMA_URL="${OLLAMA_URL:-http://localhost:11434}" check() { local name="$1" local url="$2" if curl -sf "$url" > /dev/null 2>&1; then echo " ✓ $name" else echo " ✗ $name (unreachable: $url)" fi } echo "🩺 Second Brain — Health Check" echo "" check "RAG API" "$API_URL/api/v1/health" check "Ollama" "$OLLAMA_URL/api/tags" echo "" echo "Detailed API health:" curl -sf "$API_URL/api/v1/health" | python3 -m json.tool 2>/dev/null || echo "(API unavailable)" echo "" echo "Stats:" curl -sf "$API_URL/api/v1/stats" | python3 -m json.tool 2>/dev/null || echo "(API unavailable)"