#!/bin/bash # Mempool frontend health check — managed by Ansible (roles/mempool) # The exit code is the answer; systemd keeps it. Reporting is optional. PUSH_URL="${HEALTHCHECK_PUSH_URL:-}" FRONTEND_PORT="{{ mempool_frontend_port }}" check() { curl -sf --max-time 5 "http://localhost:${FRONTEND_PORT}" > /dev/null 2>&1 } report() { [ -n "$PUSH_URL" ] || return 0 curl -s --max-time 10 --retry 2 -o /dev/null \ "${PUSH_URL}?status=$1&msg=${2// /%20}&ping=" || true } if check; then report up "OK"; exit 0 else echo "Mempool frontend not responding"; report down "Mempool frontend not responding"; exit 1; fi