scripts

shell scripts
git clone git://git.bitsmanent.org/scripts
Log | Files | Refs | README

sendpush (686B)


      1 #!/bin/sh
      2 # Send PUSH notifications via xdroid API
      3 # https://play.google.com/store/apps/details?id=net.xdroid.pn
      4 
      5 usage() {
      6 	echo "Usage: $0 [-h] -k <key> -t <title> -c <conten> [-u <uri>]"
      7 	exit 1
      8 }
      9 
     10 main() {
     11         while getopts "k:t:c:u:h" o; do
     12                 case $o in
     13 		k) apikey="$OPTARG";;
     14 		t) title="$OPTARG";;
     15 		c) content="$OPTARG";;
     16 		u) uri="$OPTARG";;
     17 		h) usage;;
     18                 esac
     19         done
     20 	shift "$(echo "$OPTIND - 1"|bc)"
     21 
     22 	[ -z "$apikey" -o -z "$content" ] && usage
     23 
     24 	curl -s --get \
     25 	--data-urlencode "k=$apikey" \
     26 	--data-urlencode "t=$title" \
     27 	--data-urlencode "c=$content" \
     28 	--data-urlencode "u=$uri" \
     29 	"https://xdroid.net/api/message"
     30 }
     31 
     32 main "$@"