Command line notifications

JCS was interviewed on the latest episode of Garbage , he spoke about his app pushover . Pushover is an Android, iOS and mac app that works with a service backend. You can send notifications to pushover via simple api (you can just use curl) and the notifications are delivered to your devices.

This is awesome, I can set up pushover on my phone, a client on my build machine and get alerts when builds are complete. No more checking while a build finishes, instead I can get notifications directly on my pebble via pushover and the pebble app.

Looking through the app directory I found the command line tool ntfy . ntfy is really easy to set up and use, for pushover you need a simple .ntfy.json (with a real user_key) like:

{
    "backends": ["pushover"],
    "pushover": { "user_key": "fjaudfaufjkjdufdaskufdaskfjads"}
}

You can then send messages with ntfy or send the result of a command:

$ ntfy -t "Test" send "This is a test message"
$ ntfy done false

By default ntfy will set the message title to the user@host, but the -t flag can override this. ntfy supports other backend services and a 'linux' backend. I though the linux backend would tie into the same thing as notify-send, but that wasn't the case. I need to figure out how those tie in.

I have to run FreeBSD builds with root privileges, I didn't want to give a tool like ntfy root access. I wrote a small alias to send the result of the previous command.

alias buildres="if [ $? -eq 0 ]; then ntfy send 'Build passed'; else ntfy send 'Build failed'; fi"