helm/bin/prowl

35 lines
703 B
Plaintext
Raw Normal View History

2013-12-20 10:16:41 -08:00
#!/bin/sh
# Sends a growl notification to prowl using curl.
#
# Usage:
# prowl [app] [title] [message]
APIKEYFILE="$HOME/.prowl-apikey"
if [ ! -f "$APIKEYFILE" ]; then
echo "$APIKEYFILE could not be found!"
exit 1
fi
APIKEY=`cat $APIKEYFILE`
# Based on if we have two or three arguments, change the default priority
if [ $# -eq "3" ]; then
APP="$1"
TITLE="$2"
MSG="$3"
2013-12-20 10:20:46 -08:00
elif [ $# -eq "2" ]; then
APP="`hostname`"
2013-12-20 10:16:41 -08:00
TITLE="$2"
MSG="$3"
else
echo "Usage: $0 [app] [title] [message]" >/dev/fd/2
exit 2
fi
curl -s https://api.prowlapp.com/publicapi/add \
-F apikey="$APIKEY" \
-F application="$APP" \
-F event="$TITLE" \
-F description="$MSG"