Verify Cron Job Actually Ran: Confirm Execution
Your cron job is scheduled, but how do you know it actually ran? Learn how to verify job execution and detect when jobs don't execute.
Why Jobs Might Not Execute
Cron jobs can be scheduled but not execute for several reasons:
- Cron daemon stops running or crashes
- System time changes, causing schedule confusion
- Job is disabled or commented out in crontab
- User account is locked or disabled
- System is powered off during scheduled time
- Resource limits prevent job from starting
- Syntax errors in crontab prevent execution
Without explicit confirmation, you have no way to know if the job actually ran.
How to Verify Job Execution
Send an explicit ping at the start and end of your job. If the ping doesn't arrive, you know the job didn't execute. The ping must be inside your script, not in the cron line.
Bash Example: Ping on Start and End
#!/bin/bashset -e# Ping at start to confirm job began# Your actual work./backup.sh./sync.sh# Ping at end to confirm job completedcurl -X POST "https://deadmanping.com/api/ping/backup-daily"Python Example: Timestamp Verification
import requestsimport datetime# Your actual workstart_time = datetime.datetime.now()perform_backup()end_time = datetime.datetime.now()duration = (end_time - start_time).total_seconds()# Single ping with duration in payload# In DeadManPing panel: set validation rule "duration" < 3600 (e.g., less than 1 hour)# Panel will automatically detect if job takes too longrequests.post(f"https://deadmanping.com/api/ping/backup-daily?duration={duration}")Node.js Example: Execution Confirmation
const https = require('https');// Your actual workconst startTime = Date.now();async function run() { await performBackup(); // Single ping with duration in payload // In DeadManPing panel: set validation rule "duration" < 3600 (e.g., less than 1 hour) // Panel will automatically detect if job takes too long const duration = Math.round((Date.now() - startTime) / 1000); https.request(`https://deadmanping.com/api/ping/backup-daily?duration=${duration}`, { method: 'POST' }).end();}run().catch((err) => { // If job fails, ping won't arrive - DeadManPing will detect missing ping process.exit(1);});Bash Example: Check Last Execution Time
#!/bin/bash# Create timestamp file to track last executionLAST_RUN_FILE="/tmp/last-backup-run"# Check if job ran recently (within last 25 hours for daily job)if [ -f "$LAST_RUN_FILE" ]; then LAST_RUN=$(cat "$LAST_RUN_FILE") NOW=$(date +%s) HOURS_SINCE=$(( (NOW - LAST_RUN) / 3600 )) HOURS_SINCE=$(( (NOW - LAST_RUN) / 3600 ))fi# Update timestampdate +%s > "$LAST_RUN_FILE"# Your actual work./backup.sh# Single ping with hours since last run in payload# In DeadManPing panel: set validation rule "hours_since" < 25# Panel will automatically detect if job hasn't run recentlycurl -X POST "https://deadmanping.com/api/ping/backup-daily?hours_since=$HOURS_SINCE"Verifying Execution with Dead Man Switch
A dead man switch verifies job execution by monitoring whether your explicit ping arrives. If the ping doesn't arrive within the expected interval, you know the job didn't execute—even if cron thinks it ran.
This works for all cases: cron daemon stops, system powered off, job disabled, syntax errors, and more. As long as your script sends a ping when it runs, missing pings indicate the job didn't execute.
Working Examples
See complete, working code examples in our GitHub repository:
View Examples on GitHub →Start Verifying Job Execution
DeadManPing monitors whether your execution pings arrive. Set up monitoring in 2 minutes, get alerts when jobs don't execute.
Start Monitoring FreeRelated Articles
Learn more about cron job monitoring and troubleshooting:
Cron Job Not Executing
How to detect when cron jobs are not executing.
Verify Cron Job Completed
How to verify that cron jobs completed successfully.
Monitor Cron Jobs: One Curl Line, No Migration
Monitor cron jobs with one curl line. No SDK, no migration—get alerts when jobs fail.
Detect Cron Job Skipped
How to detect when cron jobs are skipped—not executed when they should be.