Pushbullet notifications from Ubuntu

Pushbullet (https://www.pushbullet.com/) is a great tool which can be used on most devices to send notes, pictures, links, etc. For our purposes we can make use of it to send notifications from our NAS to our computer and/or phones.

I find this much more convenient than email notifications and have been gradually replacing my email notifications with Pushbullet notifications, since it just pops up on my phone to let me know when the NAS has done something (e.g. finished a torrent download, started up, gone to sleep, woken up, …).

Similarly to the email notifications we configured here, the Pushbullet notifications can also be run with one command on the command line.

It also simply uses HTTP push commands so you don’t even need to install anything extra to make it work. To get it set up you need to go to the Pushbullet site and register an account. This will let you get your Pushbullet API key.


Now you can run this command to send a notification (replace ‘APIKEY’ with your own key) …
curl -u APIKEY: https://api.pushbullet.com/v2/pushes -d type=note -d title=”Your NAS” -d body=’Test notification!’

To make it even easier you can set up a little script which makes sending a notification more intuitive…

mkdir -p ~/scripts/pushbullet
nano ~/scripts/pushbullet/pushbullet.sh

Add this to the script  (adding your own API key towards the top):

#!/bin/sh
# Script for sending notifications to phone and Chrome with pushbullet

TITLE=$1
BODY=$2
APIKEY="?????????????????????????????"

if [ "$1" = "" -o "$2" = "" ] ; then
echo "Use: /bin/pushbullet.sh \"Message Title\" \"Message Body\""
exit 1
fi

curl -u $APIKEY: https://api.pushbullet.com/v2/pushes -d type=note -d title="$TITLE" -d body="$BODY"

Make the script executable:

chmod 755 ~/scripts/pushbullet/pushbullet.sh

Now you can add a command to various scripts for notifications (e.g. in boot script or rc.local) or just run from the command line like this:

~/scripts/pushbullet/pushbullet.sh "Note title" "Note message sent at `date`"

Also note that you can add Ubuntu variables, such as date above, by putting them in quotes.

Leave a Reply

(email optional)


Warning: Undefined array key "rerror" in /home/public/blog/wp-content/plugins/wp-recaptcha/recaptcha.php on line 291