AI News Hub Logo

AI News Hub

I Built a Cron Job Monitoring API in a Weekend

DEV Community
Jack

Every developer has at least one cron job running somewhere — backups, data processing, sending reports. And every developer has had the experience of discovering a cron job stopped running days (or weeks) ago. The issue: cron doesn't notify you about failures by default. Your 0 2 * * * /opt/backup.sh could silently fail for a month before someone notices. I built CronPing, a lightweight API for monitoring cron jobs: Sign up — get an API key Create a monitor — specify the expected interval Add a ping to your cron job: && curl -s https://cronping.anethoth.com/ping/YOUR_TOKEN Get alerted via webhook when a job misses its schedule # Before (silent failure) 0 2 * * * /opt/backup.sh # After (monitored) 0 2 * * * /opt/backup.sh && curl -s https://cronping.anethoth.com/ping/abc123 # Sign up curl -X POST https://cronping.anethoth.com/api/v1/signup \ -H "Content-Type: application/json" \ -d '{ "email": "[email protected]" }' # Create a monitor curl -X POST https://cronping.anethoth.com/api/v1/monitors \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "nightly-backup", "interval_seconds": 86400, "grace_seconds": 300 }' FastAPI for the API SQLite for storage Background task that checks for overdue monitors Docker for deployment Free tier: 3 monitors with 7-day history. Check it out at cronping.anethoth.com.