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

Get a phone notification when a long command finishes

low-code

Get a push notification on your phone when a long-running terminal command finishes. Chain a curl to your Hook.Notifier URL. Walk away, get pinged. Free.

To get a push when a long command finishes, chain a call to your Hook.Notifier URL after it. Start the command, walk away, and your phone tells you the moment it is done.

Big builds, data migrations, model training, video encodes: you start them, then waste time watching a progress bar. One appended curl frees you from the terminal.

The one-liner

Chain the notification after your command with &&:

./long-build.sh && curl -s "https://hooknotifier.com/{IDENTIFIER}/{KEY}?object=Done&body=long-build%20finished"

Start it, close the laptop lid or go make coffee, and the push arrives when the build ends.

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 chain it after your commands.

Tell me if it worked or failed

The && only fires on success. To always be told, and to know the outcome, check the exit code:

./long-build.sh
if [ $? -eq 0 ]; then
  curl -s "https://hooknotifier.com/{IDENTIFIER}/{KEY}?object=Build%20done&body=Finished%20successfully"
else
  curl -s "https://hooknotifier.com/{IDENTIFIER}/{KEY}?object=Build%20FAILED&body=Exited%20with%20an%20error&priority=high&color=%23EE6767"
fi

Now you get "done" or "failed" on your phone, no need to look back at the terminal.

Notify after a command you already started

Forgot to chain it and the command is already running? Queue the notification to fire the moment it exits, using the shell's wait on its process, or just chain onto a quick follow-up:

# after the running job's PID, e.g. 4821
wait 4821; curl -s "https://hooknotifier.com/{IDENTIFIER}/{KEY}?object=Done&body=The%20job%20finished"

Turn it into a reusable helper

Drop a small function in your shell profile so any command can notify you:

# ~/.bashrc
notifyme() {
  "$@"
  curl -s "https://hooknotifier.com/{IDENTIFIER}/{KEY}?object=Done&body=$*%20finished"
}

Then run notifyme ./long-build.sh and get pinged when it ends, whatever the command is.

Why it matters

The most wasted minutes in a developer's day are the ones spent watching something run. A push that reaches your phone the second it finishes lets you actually walk away and get on with something else.

New to this? Start with how to send yourself a native push notification, or see the same idea for any shell script.