Monitoring Cron Jobs with Notifery

Stop silent cron job failures from catching you off guard.

Monitoring Cron Jobs with Notifery

Cron jobs fail silently. Your backup script could be broken for weeks before you notice—usually when you actually need that backup.

The fix is simple: wrap your cron commands so they report success or failure. Notifery does this by capturing command output, exit codes, and execution time, then sending you a notification when something goes wrong.

Step-by-Step Setup

1. Create a Notifery Zone

  • Sign in to Notifery.
  • Create a new Zone (e.g., my-server). Zones organize your events logically.

2. Obtain an API Key

  • From your Zone settings, generate an API key.
  • Copy this key-you’ll need it shortly.

3. Download the Notifery CLI

Use curl to download:

curl -O https://docs.notifery.com/scripts/notifery-event.sh
chmod +x notifery-event.sh

Place this script somewhere accessible, such as /usr/local/bin.

4. Configure the API Key

Edit notifery-event.sh and add your API key:

DEFAULT_API_KEY="your-api-key-here"

5. Testing the Setup

Run a simple test:

./notifery-event.sh "Test Event" my-server "echo 'Hello, Notifery!'"

Check Notifery’s dashboard to confirm receipt.

Monitoring Cron Jobs

Wrap your existing cron jobs with Notifery’s CLI:

Original cron job:

0 2 * * * /usr/bin/mysqldump -u root mydb > /backups/mydb.sql

Wrapped with Notifery:

0 2 * * * /path/to/notifery-event.sh "Daily Backup" my-server#backups "/usr/bin/mysqldump -u root mydb > /backups/mydb.sql" > /dev/null 2>&1
  • This sends notifications to Notifery with job output and exit codes.
  • >/dev/null 2>&1 prevents cron email noise; Notifery handles alerting.

Leveraging Exit Codes and Error Alerts

Notifery tracks exit codes automatically:

  • 0: Success
  • Non-zero: Failure (sends immediate alerts)

Configure your Notifery Zone to notify on errors only, reducing noise.

Advanced Features

Organize Events with Zones and Groups

Use zone#group format to categorize events (e.g., my-server#database). Easily filter and manage alerts.

Structured Logs and Performance Tracking

Notifery captures command output and duration. Structured output (e.g., JSON) is parsed automatically, aiding debugging.

Key Benefits

  • Real-time notifications: Instantly detect failures.
  • Centralized logs: View cron outputs without accessing servers directly.
  • Simple integration: Minimal changes to existing cron jobs.

Conclusion

Once you’ve wrapped your cron jobs with Notifery, you’ll know immediately when something fails instead of discovering it weeks later.

More Articles

Setting up Google Calendar sync for OpenClaw

Setting up Google Calendar sync for OpenClaw

How I set up read-only Google Calendar sync for my personal AI assistant running on a home server VM.

Better Clipboard Handling in Claude Code

Better Clipboard Handling in Claude Code

A plugin that makes clipboard operations in Claude Code more reliable and natural to use.

Get notified when Claude Code needs your input

Get notified when Claude Code needs your input

Stop constantly checking your terminal. Set up notifications that alert you when Claude Code is ready for your input.

Auto-format generated Code with Claude Code Hooks

Auto-format generated Code with Claude Code Hooks

How to set up a PostToolUse hook in Claude Code to automatically run prettier after every file edit or write operation.

PWA Web Share Target on Android: The Absolute URL Fix

PWA Web Share Target on Android: The Absolute URL Fix

Getting the Web Share Target API to work on Android PWAs can be frustrating. Your manifest looks correct, but the app never appears in the share sheet. Here is what finally worked.

Standard function keys on external keyboards in MacOS

Standard function keys on external keyboards in MacOS

Configure Karabiner Elements to use standard function keys on external keyboards while keeping media keys on your MacBook.

How to Clear Cloudflare Cache using a webhook

How to Clear Cloudflare Cache using a webhook

Automatically purge Cloudflare cache using webhooks and API tokens.

Multiplayer Web Game Starter / POC

Multiplayer Web Game Starter / POC

A starting point for building a web-based multiplayer game, utilizing modern web development technologies.

Caps Lock - From Shouting to Superpower

Caps Lock - From Shouting to Superpower

Rethinking the functionality of a forgotten key could lead to a powerful new tool.