Last active
August 28, 2018 19:26
-
-
Save obihann/fa95a8ca089cde7d2812df39df2b9884 to your computer and use it in GitHub Desktop.
Grab IP address and POST to Pushbullet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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