#!/bin/sh # cmd && pushover "done running cmd" # requires $PUSHOVER_USER_KEY and $PUSHOVER_API_TOKEN set in ~/.zshrc.local if [ X"${PUSHOVER_USER_KEY}" = X"" ]; then echo "\$PUSHOVER_USER_KEY not set" exit 1 fi if [ X"${PUSHOVER_API_TOKEN}" = X"" ]; then echo "\$PUSHOVER_API_TOKEN not set" exit 1 fi curl -s \ --form-string "user=${PUSHOVER_USER_KEY}" \ --form-string "token=${PUSHOVER_API_TOKEN}" \ --form-string "message=${1}" \ --form-string "device=iphone" \ https://api.pushover.net/1/messages.json | grep -v 'status":1' # reverse exit code so that no output exits 0, any output exits 1 [ $? == 1 ] && exit 0