Skip to content

Cron monitoring that observes job results without touching execution. Monitor job outcomes, not just execution.

Notifications You must be signed in to change notification settings

DeadManPing/examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DeadManPing Examples

Working code examples for backup dead man switch monitoring and cron job monitoring with DeadManPing.

This repository contains real-world examples in multiple languages showing how to:

  • Detect empty backup files (zero bytes)
  • Detect when backups don't run (dead man switch)
  • Verify backup file sizes (payload validation)
  • Detect silent cron failures
  • Check exit codes and status
  • Handle edge cases
  • Monitor job execution

Quick Start

  1. Sign up for DeadManPing (free account)
  2. Create a monitor and get your ping URL
  3. Copy an example script below
  4. Replace YOUR_MONITOR_ID with your actual monitor ID
  5. Add the script to your cron job

Examples by Problem

Backup Monitoring (Dead Man Switch)

Problem Solution Examples
Backup Didn't Run Dead man switch detects missing backups Bash | Python | Node.js
Detect Empty Backup File Check if backup file is zero bytes Bash | Python | Node.js
Detect Empty Backup File Cron Check backup file size after creation Bash | Python | Node.js
Backup File Zero Bytes Detect empty backup files Bash | Python | Node.js
Verify Backup File Size Check backup file size ranges Bash | Python | Node.js
Detect Backup File Missing Verify backup file exists Bash | Python | Node.js

Cron Job Monitoring

Problem Solution Examples
Curl Success But Wrong Response Validate API response content Bash | Python | Node.js
Silent Cron Failures Explicit success confirmation with ping Bash | Python | Node.js
Verify Cron Output Validate script output content Bash | Python | Node.js
Cron Job Exit Code Not Zero Check and handle exit codes Bash | Python | Node.js
Verify Cron Job Actually Ran Confirm job execution with pings Bash | Python | Node.js
Cron Job Returns Success But Fails Validate results, not just exit codes Bash | Python | Node.js
Cron Job Silent Failure Detection Detect failures without logs Bash | Python | Node.js
Curl Returns 200 But Wrong Data Validate API response body Bash | Python | Node.js
Detect Cron Job Partial Failure Verify all steps complete Bash | Python | Node.js
Detect Cron Job Wrong Exit Code Validate exit codes Bash | Python | Node.js
Verify Script Output Content Check output contains expected data Bash | Python | Node.js
Cron Job Not Executing Detect when jobs don't run Bash | Python | Node.js
Verify Cron Job Completed Confirm job finished successfully Bash | Python | Node.js
Detect Cron Job Skipped Catch jobs that don't run Bash | Python | Node.js
Cron Job Exit Status Check Verify exit status codes Bash | Python | Node.js

Examples by Language

Documentation

Each example links to detailed documentation on deadmanping.com:

Backup Dead Man Switch

Cron Job Monitoring

How It Works: Backup Dead Man Switch

DeadManPing uses a dead man switch pattern for backup monitoring:

  1. Your cron job runs your backup script
  2. Your backup script performs its work (rsync, database dump, etc.)
  3. Your backup script sends a ping to DeadManPing when done (with backup data like file size)
  4. If the ping doesn't arrive, you get an alert - backup didn't run or failed
  5. DeadManPing validates backup data (file size, status) and alerts if backup is empty or incorrect

Important: The ping 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 (e.g., backup file size, success status).

Example: If your backup script creates an empty file (0 bytes), DeadManPing detects this by validating the file size in the ping payload. If your backup script doesn't run at all, the ping never arrives, and DeadManPing alerts you.

Getting Your Ping URL

  1. Sign up at deadmanping.com
  2. Create a monitor
  3. Copy your unique ping URL (format: https://deadmanping.com/api/ping/YOUR_MONITOR_ID)
  4. Replace YOUR_MONITOR_ID in the examples with your actual monitor ID

Contributing

Found a bug or have a better example? Open an issue or submit a pull request!

Releases

No releases published

Packages

 
 
 

Contributors