JavaScript/Node.js scripts for monitoring cron jobs with DeadManPing.
- No dependencies required - uses built-in Node.js modules
- Replace
YOUR_MONITOR_IDin each script with your actual monitor ID from deadmanping.com - Make script executable:
chmod +x script.js - Add to crontab:
0 3 * * * /usr/bin/node /path/to/script.js
- detect_empty_backup_file_cron.js - Detect when backup files are empty
- verify_cron_job_actually_ran.js - Verify job execution with timestamps
- verify_cron_job_completed.js - Confirm job finished successfully
- cron_job_exit_code_not_zero.js - Check exit codes
- cron_job_exit_status_check.js - Verify exit status
- detect_cron_job_wrong_exit_code.js - Detect false success
- silent_cron_failures.js - Detect silent failures with process handlers
- cron_job_silent_failure_detection.js - Always ping on success
- detect_empty_backup_file.js - Check backup file size
- detect_backup_file_missing.js - Verify backup file exists
- backup_file_zero_bytes.js - Detect zero-byte backups
- verify_backup_file_size.js - Validate file size ranges
- curl_success_but_wrong_response.js - Validate API responses
- curl_returns_200_but_wrong_data.js - Check response body content
- verify_cron_output.js - Validate script output
- verify_script_output_content.js - Check output content
- detect_cron_job_partial_failure.js - Verify multi-step jobs
- cron_job_returns_success_but_fails.js - Validate results
- cron_job_not_executing.js - Detect non-execution
- detect_cron_job_skipped.js - Catch skipped jobs
- Use process handlers -
process.on('exit')andprocess.on('uncaughtException')to catch failures - Check results - Don't just trust exit codes, verify actual results
- Handle async errors - Use
.catch()for async functions - Use try-catch - Wrap execSync in try-catch to handle exit codes
- Validate JSON - Always validate JSON responses before using
All examples use only built-in Node.js modules:
fs- File system operationschild_process- Running shell commandshttps- HTTP requests
No npm install required!
See deadmanping.com for detailed documentation on each problem and solution.