Backup Didn't Run - How to Detect Missing Backups
Backup nie zadziałał — jak się dowiedzieć?
Dead man switch monitoring detects when backup jobs don't run and sends alerts immediately.
The Problem: Backup Didn't Run
Your backup job is scheduled to run daily, but it didn't execute. How do you know? Common reasons backups don't run:
- Cron job gets disabled or removed
- Cron daemon stops or crashes
- System reboot without cron restart
- Permission errors prevent script execution
- Script path changes after system update
- Disk space exhaustion prevents script from starting
Without monitoring, you might discover your backups haven't been running for weeks when you need them most. Traditional file-based monitoring (checking if backup files exist) doesn't tell you if the backup ran today or last month.
Solution: Dead Man Switch Detects Missing Backups
A dead man switch works by monitoring whether your backup script sends a ping after each successful run. If the ping doesn't arrive within the expected interval (e.g., daily backups should ping every 24 hours), you get an alert. It's independent of your backup infrastructure, so it detects failures even if your monitoring system is down.
DeadManPing doesn't run your backups. Your cron does. DeadManPing only observes if the ping arrived.
Important: The curl command must be inside your backup script, not in the cron line, because only in the script do you have access to variables from execution results. If the script fails before reaching the ping, the ping never arrives, and DeadManPing alerts you.
How to Detect Backup Didn't Run
Add a dead man switch to your backup script. If the backup doesn't run, the ping never arrives, and you get an alert.
Bash Example
#!/bin/bash
set -e
# Run backup
rsync -avz /data/ user@backup-server:/backups/
# Single ping at end - if backup doesn't run, ping won't arrive
# DeadManPing will alert if ping doesn't arrive within expected interval
curl -X POST "https://deadmanping.com/api/ping/backup-daily"The set -e ensures the script exits on any error, so the ping only happens if rsync succeeds. If the script fails or doesn't run, the ping never arrives.
Python Example
#!/usr/bin/env python3
import subprocess
import requests
import sys
try:
# Run backup
subprocess.run(['rsync', '-avz', '/data/', 'user@backup-server:/backups/'], check=True)
# Single ping at end - if backup doesn't run, ping won't arrive
requests.post('https://deadmanping.com/api/ping/backup-daily')
except Exception as e:
# If backup fails, script exits and ping never arrives
sys.exit(1)Node.js Example
#!/usr/bin/env node
const { execSync } = require('child_process');
const https = require('https');
try {
// Run backup
execSync('rsync -avz /data/ user@backup-server:/backups/', { stdio: 'inherit' });
// Single ping at end - if backup doesn't run, ping won't arrive
https.request('https://deadmanping.com/api/ping/backup-daily', { method: 'POST' }).end();
} catch (error) {
// If backup fails, script exits and ping never arrives
process.exit(1);
}Setting Up Monitoring Intervals
Match your monitoring interval to your backup frequency, with a grace period:
- Daily backups - Expect ping every 24 hours, alert if missing for 25+ hours
- Hourly backups - Expect ping every hour, alert if missing for 65+ minutes
- Weekly backups - Expect ping every 7 days, alert if missing for 8+ days
The grace period accounts for slight timing variations and gives you time to respond before it's critical.
Start Detecting Missing Backups
DeadManPing provides dead man switch monitoring for backup jobs. Set up monitoring in 2 minutes, get alerts when backups don't run. Learn more about backup dead man switch.
Related Articles
Learn more about cron job monitoring and troubleshooting:
Dead Man Switch for Backups
Implement dead man switch monitoring for backup jobs to detect failures immediately.
Backup Monitoring Without Infrastructure
How to monitor backups without Kubernetes, Prometheus, or complex infrastructure.
Detect Empty Backup File
How to detect when backup files are empty or zero bytes.
Backup Monitoring Service
Backup monitoring that doesn't touch your execution.