OED tools: Pushover
The problem
In my last post about Linux at command I talked about notifications on my mobile.
In most of my automation scripts I prefer notifications to come to my mobile instead of via email or SMS (really? in 2015?) because:
- it is always with me
- I check it thousands times a day (I know you too ;-) )
- it is a preferred channel - a specific app just for that
The automation
There are many notification services available today for free or minimal cost. When I needed it, after evaluating a few solutions, I chose Pushover.
Main advantages of Pushover:
- no monthly fees
- 7500 messages per month - much more than I needed so far
- API available for most programming languages
- client available for many platforms
For bash scripts I call a Python script sendpush.py:
# !/usr/bin/python
''' last change: 20151203 notify to pushover '''
import commands import httplib, urllib import sys
def sendPush(messageText):
conn = httplib.HTTPSConnection("api.pushover.net:443")
conn.request("POST", "/1/messages.json",
urllib.urlencode({
"token": "REPLACE_WITH_YOUR_TOKEN",
"user": "REPLACE_WITH_YOUR_USER",
"message": messageText,
}), { "Content-type": "application/x-www-form-urlencoded" })
conn.getresponse()
def main():
sendPush(sys.argv[1])
main()
Usually I set a notification when the script starts, ends and a final one with a check of the expected output.
I had positive experiences with Pushover so far, messages always arrived on time and never got lost in the path so I'm not actively looking for a replacement (not very Kaizen...) but suggestions are welcome.