Skip to content

Instantly share code, notes, and snippets.

@jacobkossman
Last active July 31, 2016 22:55
Show Gist options
  • Save jacobkossman/57bf3e28a7f4c0e264029994c712f33d to your computer and use it in GitHub Desktop.
Save jacobkossman/57bf3e28a7f4c0e264029994c712f33d to your computer and use it in GitHub Desktop.
Raspberry Pi Pushbullet Boot
#!/bin/bash
IPAddress=$(hostname -I)
OLDIPAddress="192.168.1.14"
# remove spaces
IPAddress=${IPAddress// }
if [ "$IPAddress" != "$OLDIPAddress" ] ; then
# if ip is different, then pushbullet
curl https://api.pushbullet.com/v2/pushes \
-u PUSHBULLET_O_AUTH_TOKEN: \
-d type="note" \
-d title="Pi IP: $IPAddress" \
-d body="Pi has booted and has ip of $IPAddress"
fi

Raspberry Pi (or Linux) Script on Boot to Alert IP Change

Grab oauth token: [https://www.pushbullet.com/#settings/account](Pushbullet Settings)

touch ipcheck.sh
nano ipcheck.sh

Add token to ipcheck.sh code

Make executable

chmod +x ipcheck.sh

Add to crontab to enable on reboot

crontab -e

@reboot /home/pi/ipcheck.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment