Skip to content

Python cron heartbeat (dead-man switch)

Your cron silently stopped running. Need an alert when the script misses its window.

Recipe

python
import os, sys, requests

# После каждой успешной итерации cron — пинг heartbeat
HEARTBEAT = os.environ["HEARTBEAT_URL"]  # https://enterno.io/hb/<token>

def main() -> None:
    # ... ваша работа ...
    try:
        requests.post(HEARTBEAT, timeout=5)
    except requests.RequestException:
        pass  # не ломаем основной job из-за telemetry

if __name__ == "__main__":
    sys.exit(main())

Same thing in Enterno.io

Enterno heartbeat monitors alert when the ping misses its expected window (e.g. ±2 min for an hourly job). No external containers.

Set up Heartbeat monitor → ← All recipes