Pushbullet is a great app that allows you to share notifications to and from your phone/computer. I recently saw Dead Man’s Snitch (a service which alerts you about cron jobs) and figured I could probably replicate the most important functionality for me using Pushbullet. After all, being a poor student is all about saving as much money as possible!
Playing around with the Pushbullet API whilst setting up backup notifications for my servers, I wondered if I could get a push notification every time (hopefully) just me logged in via SSH.
I ended up with the following bash script that can be added to your bash login script (~/.bash_profile)
1 2 3 4 5
#!/bin/bash IP=($SSH_CLIENT) name=$(whoami) string="SSH Login from $IP for $name" /home/admin/pushbullet/pushbullet push all note "$string"
It uses this library from Github, but could do it without the library at all if you’re not as lazy as I am. More Pushbullet goodness soon!