helm/bin/prowl
2013-12-20 13:16:41 -05:00

36 lines
701 B
Bash
Executable file

#!/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"