From 76cfacaba892758c478ba008311e0d88d498cff0 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 20 Dec 2013 13:16:41 -0500 Subject: [PATCH] Add curl-to-prowl script --- bin/prowl | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 bin/prowl diff --git a/bin/prowl b/bin/prowl new file mode 100755 index 00000000..86f29da4 --- /dev/null +++ b/bin/prowl @@ -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" +