Menu

I Built a Cron Job Monitoring API in a Weekend
πŸ“°

I Built a Cron Job Monitoring API in a Weekend

DEV CommunityΒ·JackΒ·6 months ago
#WNQS8Q58
#api#showdev#python#devops#cronping
Reading 0:00
15s threshold

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.

The Solution

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

Example

# Before (silent failure) 0 2 * * * /opt/backup.sh

# After (monitored) 0 2 * * * /opt/backup.sh && curl -s https://cronping.anethoth.com/ping/abc123

Enter fullscreen mode

Exit fullscreen mode

API Design

# Sign up curl -X POST https://cronping.anethoth.com/api/v1/signup \ -H "Content-Type: application/json" \ -d '{ "email": "[email protected]" }'

#…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.