background-hooknotifierbackground-hooknotifier
Last update: Jul 04, 20261 minutes read

Send yourself a notification from a shell script or cron job

low-code

Send yourself a push notification from any shell script or cron job with one line of curl. No app, no backend. Free with Hook.Notifier.

To send yourself a notification from a shell script, add one line of curl that calls your Hook.Notifier URL. Put it wherever you want the ping.

curl "https://hooknotifier.com/{IDENTIFIER}/{KEY}?object=Done&body=The%20script%20finished"

Notify on finish

Drop it at the end of any long job so you know the moment it wraps up.

./train-model.sh
curl "https://hooknotifier.com/{IDENTIFIER}/{KEY}?object=Training%20done&body=The%20model%20finished%20training"

Success or failure, two messages

Use && and || to send a different notification depending on how the command went.

./deploy.sh \
  && curl "https://hooknotifier.com/{IDENTIFIER}/{KEY}?object=Deploy%20OK&body=Production%20is%20live" \
  || curl "https://hooknotifier.com/{IDENTIFIER}/{KEY}?object=Deploy%20failed&body=Check%20the%20logs&color=%23EE6767"

From a cron job

Same line, inside your crontab. Here your nightly backup pings you when it is done.

# crontab -e
0 3 * * * /home/me/backup.sh && curl -s "https://hooknotifier.com/{IDENTIFIER}/{KEY}?object=Backup&body=Nightly%20backup%20finished&priority=low"

Note the priority=low. A nightly log does not deserve a 3am buzz: low priority lands in your inbox without pushing your phone. Save high or critical for the failures.

One notification for a long job

A long script does not need two notifications. The send returns {"status":"ok","id":42}. Keep the id, then PUT to the same URL plus /id to update the notification in place. The "started" push becomes the "done" push.

ID=$(curl -s "https://hooknotifier.com/{IDENTIFIER}/{KEY}?object=Migration&body=Started" | grep -o '[0-9]\+')
./migrate.sh
curl -s -X PUT "https://hooknotifier.com/{IDENTIFIER}/{KEY}/$ID?object=Migration&body=Done"

A reminder from the terminal

delay schedules the send (30s, 10m, 2h, 1d, up to 3 days), which turns your hook into a one line reminder.

curl -s "https://hooknotifier.com/{IDENTIFIER}/{KEY}?object=Reminder&body=Check%20the%20staging%20deploy&delay=2h"
hook notifier notification

First get your URL

Your Hook.Notifier URL is https://hooknotifier.com/{IDENTIFIER}/{KEY}. Create a free account to get yours, then paste it into your scripts.

Why it matters

Long jobs and cron tasks run when you are not watching. A one line ping means you stop babysitting a terminal and find out the moment something finishes or breaks.

New to this? Start with how to send yourself a native push notification.