Add curl-to-prowl script
This commit is contained in:
parent
264b0ecb42
commit
76cfacaba8
35
bin/prowl
Executable file
35
bin/prowl
Executable 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"
|
||||||
|
|
Loading…
Reference in a new issue