Skip to content

Instantly share code, notes, and snippets.

@obihann
Last active August 28, 2018 19:26
Show Gist options
  • Select an option

  • Save obihann/fa95a8ca089cde7d2812df39df2b9884 to your computer and use it in GitHub Desktop.

Select an option

Save obihann/fa95a8ca089cde7d2812df39df2b9884 to your computer and use it in GitHub Desktop.
Grab IP address and POST to Pushbullet
[Unit]
Description=PiiP Service
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=pi
WorkingDirectory=/home/pi
ExecStart=/usr/bin/piip.sh
[Install]
WantedBy=multi-user.target
#!/bin/sh -e
_PB_TOKEN='TOKEN'
_IP=$(/bin/hostname -I)
_BODY='{"body":"'$_IP'","title":"Pi IP","type":"note"}'
/usr/bin/curl -sv -H "Access-Token: $_PB_TOKEN" -H "Content-Type: application/json" -d "$_BODY" -X POST https://api.pushbullet.com/v2/pushes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment