Skip to content

Commit

Permalink
add mobilme notification section and prowlpost script
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Host committed May 8, 2015
1 parent 3ad4c6b commit 1178fab
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions mobile-notification/prowlpostinstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

__prowlpostinstall() {
printf "\n%s" $__Y_"installing prowlpost utility..."

cat << 'EOF' > $HOME/bin/prowlpost
#!/bin/sh
# Kenneth Finnegan, 2012
# kennethfinnegan.blogspot.com
# Posts growl notifications to iOS device using prowl & curl
#
# Pass this script two (or three) arguments with the message title,
# (the message priority,) and the message.
#
# Dumps the XML response from prowl to LOG, which can be ignored
# unless you're coming anywhere close to the 1000/hr rate.
# 2012 03 08: Initial fork from morningreport.sh
# 2012 03 21: Replaced the hardcoded application name with `hostname`
APIKEY=73fa736a3e915e8fd087fbb33d0f09acd9523a9c
LOG="/tmp/prowl.log"
touch $LOG
chmod -f 666 $LOG
# Based on if we have two or three arguments, change the default priority
if [ $# -eq "2" ]; then
EVENT_NAME=$1
PRIORITY="0"
EVENT_DESC=$2
elif [ $# -eq "3" ]; then
EVENT_NAME=$1
PRIORITY=$2
EVENT_DESC=$3
else
echo "USAGE: $0 \"Event name\" \"[priority]\" \"Message body\" " \
>/dev/fd/2
exit
fi
# Post notification to Prowl using curl
curl -s https://api.prowlapp.com/publicapi/add \
-F apikey="$APIKEY" \
-F priority="$PRIORITY" \
-F application="`hostname`" \
-F event="$EVENT_NAME" \
-F description="$EVENT_DESC" > /tmp/prowl.log
EOF
chmod +x $HOME/bin/prowlpost
}

0 comments on commit 1178fab

Please sign in to comment.