CallMeMCP/call-me

Get notified when a long command finishes, and called when it fails

·

Give your scripts your phone number, and a long job that fails at 2 am can ring you and ask what to do next.

The short answer to "how do I get notified when a command finishes": put a notifier after it. long-command; notify-send done tells you either way, && only when it worked, || only when it failed. At the desk, the terminal bell or a desktop notification is enough. On your phone, ntfy's --wait-cmd is the easiest push. A phone call is worth it in one case: the job failed and someone has to decide what happens next. I built /call-me, which does that call, so weigh that part with this in mind. I read every doc linked below today, November 28, 2026.

Done, or failed and waiting on you?

They are two different messages. "It's done" is news: a sound or a push covers it, and you read it whenever you like. "It failed, should I retry?" is a question, and the job does nothing until someone answers. The shell already tells them apart:

make release; notify-send "make finished"      # either way
make release && notify-send "release built"    # only when it worked
make release || notify-send "release failed"   # only when it failed

How do I get a notification when a command finishes at my desk?

The oldest way is the bell: printf '\a' after the command, and most terminals flash, bounce or badge. On Linux, notify-send "Build done" shows a desktop notification. On a Mac, osascript -e 'display notification "Build done" with title "Terminal"' does the same, and say done reads it out.

Some terminals do it without a command. Ghostty has notify-on-command-finish since 1.3.0, set to unfocused or always, and it needs shell integration or OSC 133 marks (Ghostty docs). kitty has notify_on_cmd_finish, with an invisible setting for a command in a tab you can't see (kitty docs). In iTerm2, Edit > Marks and Annotations > Alert on next mark, or Cmd-Opt-A, alerts you when the prompt comes back (iTerm2 docs). Windows Terminal has none yet: the request, microsoft/terminal#6372, has been open since June 2020.

How do I send a notification to my phone from the terminal?

ntfy is the shortest path. Install the app, subscribe to a topic, and wrap the command: ntfy pub --wait-cmd mytopic make release posts "Command succeeded after ..." when it ends, and ntfy pub --wait-pid 8458 mytopic waits for a job you already started (ntfy CLI docs). Without the CLI, curl -d "Build done" ntfy.sh/mytopic works too. ntfy's own docs warn that topic names are public, so pick one nobody can guess.

A Telegram bot is one curl as well: curl "https://api.telegram.org/bot<token>/sendMessage" -d chat_id=<id> -d text="Build done". Pushover's emergency priority repeats the push until you acknowledge it (Pushover API). For "it's done", any of these is the right tool, and you don't need a call.

Can a script call my phone when it fails?

Yes, in three ways. ntfy can phone a verified number on its Pro plans with the X-Call header, and reads the message aloud in English, but you can only listen (ntfy publish docs). Twilio can place the call if you set up an account, a number and the call script. /call-me rings its app on your iPhone or Android and sends back what you said as text, so the script can act on your answer. Its /ring endpoint is documented in the README: it waits until you answer and returns a transcript.

Here is a wrapper that runs any command and stays quiet when it works. When it fails, it rings you, reads out the exit code and the last five lines of output, and retries or stops depending on what you say. Save it as ring-on-fail somewhere on your PATH, run chmod +x on it, and set CALLME_TO to the 10-digit number in the app:

#!/bin/bash
# ring-on-fail: run a command. If it fails, ring my phone with the last lines and do what I say.
api="${CALLME_API:-https://callmemcp.com}"
log=$(mktemp)
"$@" 2>&1 | tee "$log"
rc=${PIPESTATUS[0]}
[ "$rc" -eq 0 ] && exit 0
last=$(tail -n 5 "$log" | tr '\n' ' ' | cut -c1-600)
ask="$1 failed with exit code $rc. The last lines say: $last. Should I retry or stop?"
res=$(jq -nc --arg to "$CALLME_TO" --arg t "$ask" '{to:$to, text:$t, from:"ring-on-fail"}' \
  | curl -sS --max-time 320 "$api/ring" -H 'content-type: application/json' -d @-)
ans=$(printf '%s' "$res" | jq -r '.transcript // ""' | tr '[:upper:]' '[:lower:]')
id=$(printf '%s' "$res" | jq -r '.call_id // empty')
tok=$(printf '%s' "$res" | jq -r '.session_token // empty')
bye() {  # the line stays open after an answer, so end it
  [ -n "$id" ] && jq -nc --arg s "$tok" --arg t "$1" '{session_token:$s, text:$t}' \
    | curl -sS --max-time 20 "$api/aiphone/calls/$id/hangup" -H 'content-type: application/json' -d @- >/dev/null
}
case "$ans" in
  no*|*"don't"*|*stop*) bye "Okay, I'll leave it."; exit "$rc" ;;
  *retry*|*again*|yes*) bye "Retrying now."; exec "$0" "$@" ;;
  *) bye "Okay, I'll leave it."; exit "$rc" ;;
esac

Then put it in front of the long job:

export CALLME_TO=<your 10 digits>
ring-on-fail make release

A no, a "don't" or a "stop" ends it with the command's own exit code, and so does a missed call or an answer it can't read, so a script after it still sees the failure. A yes, "retry" or "again" runs the command once more, and if that fails too, you get another call. The /call-me line stays open after you answer so an agent can keep talking, which is why the script hangs up with one last line. I ran it against a stub of /ring for a command that works, one that fails and gets a no, a flaky one that gets a retry and then passes, and a missed call. To watch the call go through before you rely on it, use the demo line 5550001234, which answers by itself (try the demo).

What about training runs, CI and cron?

A training run is just a long command, so ring-on-fail python train.py works, and the last lines you hear are usually the error, "CUDA out of memory" and all. In GitHub Actions, a step with if: failure() can run the same script, or send a text with /text from the README if a call is too much for a red build.

Cron is the one case this can't cover. A job that never started never fails, so nothing rings. For that you want a dead man's switch such as Healthchecks.io, which alerts you when a ping does not arrive on time.

If the long job is an AI agent rather than a script, the agent can make the call itself: Claude Code notifications on your phone has the hooks, and Every way to get a phone call from your AI agent compares the tools. More ideas for jobs that run without you are on the use cases page.

All posts

Give your AI a number to call you

Get the app, give your agent the number, and it can ring you or text you.

Download on the App Store Get it on Google Play
Set it up in three steps Try the live demo