Free tools

Cron job alert script

Generate a wrapper that runs your command and sends a Trigv alert on failure, success, or a slow run. Free, in your browser, no signup.

Notify on

Wrapper

Runs in your browser. Nothing you enter is stored.

Get your API key and this works in 2 minutes

Create a key, export TRIGV_API_KEY, and run the wrapper once by hand before you put it in cron.

curl -sS -X POST https://api.trigv.com/v1/events \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $TRIGV_API_KEY" \
  -d '{"channel":"cron","title":"Nightly backup failed","level":"error"}'

How to use it

  1. Enter the command the cron job should run, and a short job name.
  2. Choose when to notify. Failure is the one that matters if you only want bad news.
  3. Copy or download the script. It reads TRIGV_API_KEY from the environment.
  4. If you added a schedule, put that crontab line on the server so cron calls the wrapper.

About this tool

A crontab line starts a command and then forgets it. If the backup exits 1, cron’s own mail is easy to miss and often never configured. The wrapper on this page runs the command, keeps the exit code and the duration, and posts one event to Trigv.

The level follows the result. A non-zero exit is error. A zero exit is success. If you set a slow-run threshold and the command is still zero but slower than that, the level is warning. You can turn each of those off. The last lines of output go in the description, up to the number you choose, and an idempotency key is built from the job name and the start time so a retry of the same run does not count twice.

The script never contains your API key. It expects TRIGV_API_KEY in the environment of the user who owns the crontab. Put the key in that user’s shell profile or in the crontab’s own environment, not in the script you commit.

Bash, Python, PHP, and Node versions call the same endpoint: POST https://api.trigv.com/v1/events. Required fields are channel and title. Optional fields used here are description, level, and idempotency_key. Levels are info, success, warning, and error.

Questions

Where does the API key go?

In the TRIGV_API_KEY environment variable. The generated script refuses to run if it is missing. Do not paste a real key into this page.

What is the idempotency key?

It is the job name plus the start time. If the same run is posted twice, Trigv returns the original event and does not count the usage again.

Does a slow success still alert?

Only if you check Slow run. A failed command stays error even if it was also slow.

Can I schedule it here?

You can paste a cron expression and the page adds a crontab line that calls the wrapper. Use the cron expression generator if you need to build that expression.