Add curl-to-prowl script

This commit is contained in:
Henrik Lissner 2013-12-20 13:16:41 -05:00
parent 264b0ecb42
commit 76cfacaba8

35
bin/prowl Executable file
View file

@ -0,0 +1,35 @@
#!/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"
if [ $# -eq "2" ]; then
APP=`hostname`
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"