Last active
June 19, 2017 22:06
-
-
Save sasha42/b999032ecdd799ffde6fb44f602c1dce to your computer and use it in GitHub Desktop.
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/bash | |
# Quick and dirty script to get IP and dl speed | |
# of a Pi on boot | |
# sleep to wait for wifi | |
sleep 20 | |
# get the local IP | |
localip=$(/sbin/ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1') | |
# do a speedtest (requires speedtest-cli to be installed) | |
speedtest=$(/usr/local/bin/speedtest --simple) | |
down=$(echo $speedtest | awk '/Download:/{print $5}') | |
echo $HOSTNAME $localip $speedtest | |
# push data to pushbullet | |
curl -u TOKEN: https://api.pushbullet.com/v2/pushes -d type=note -d title=$localip -d body=$down | |
# curl the public IP (not pushed) | |
#wanip=$(curl ifconfig.co) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment