Skip to content

Instantly share code, notes, and snippets.

@sasha42
Last active June 19, 2017 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sasha42/b999032ecdd799ffde6fb44f602c1dce to your computer and use it in GitHub Desktop.
Save sasha42/b999032ecdd799ffde6fb44f602c1dce to your computer and use it in GitHub Desktop.
#!/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