Monitor Database Backup Cron Jobs

Use Cases

The Problem

Database backups are the most critical cron job in any stack. A failed backup that goes undetected could mean catastrophic data loss during a disaster.

The Solution

Wrap your pg_dump, mysqldump, or mongodump command with CronRabbit monitoring. Track duration to detect backup growth, and get instant alerts on failure.

Why Backup Monitoring is Non-Negotiable

A backup cron job can silently fail for months: disk full, credentials expired, database locked, or network timeout. You only discover the failure when you need to restore — the worst possible time.

Duration Tracking

Use CronRabbit's /start signal to track backup duration. If your nightly backup suddenly takes 4 hours instead of 30 minutes, you'll see the trend before it starts failing.

Code Examples

PostgreSQL backup with monitoring

Bash
#!/bin/bash
set -euo pipefail
PING="https://ping.cronrabbit.com/your-id"
curl -fsS -m 5 --retry 3 --retry-all-errors "$PING/start"

DUMP_FILE="/backups/pg_$(date +%Y%m%d_%H%M%S).sql.gz"
pg_dump -h localhost -U postgres mydb | gzip > "$DUMP_FILE"

# Upload to S3
aws s3 cp "$DUMP_FILE" s3://my-backups/postgres/
rm "$DUMP_FILE"

curl -fsS -m 10 --retry 5 --retry-all-errors "$PING"

MySQL backup with monitoring

Bash
#!/bin/bash
set -euo pipefail
PING="https://ping.cronrabbit.com/mysql-backup-id"
curl -fsS -m 5 --retry 3 --retry-all-errors "$PING/start"

mysqldump --all-databases | gzip > /backups/mysql_$(date +%Y%m%d).sql.gz

curl -fsS -m 10 --retry 5 --retry-all-errors "$PING"

Ready to Monitor Your Cron Jobs?

Create your free account and add your first monitor in under 5 minutes. No credit card required.