Skip to content

Instantly share code, notes, and snippets.

@gvoysey
Last active July 28, 2016 18:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gvoysey/d1dc51840b71ad940369 to your computer and use it in GitHub Desktop.
Save gvoysey/d1dc51840b71ad940369 to your computer and use it in GitHub Desktop.
Texts you your IP address (useful for headless linux boxes, raspberry pis, etc)
#!/bin/bash
myIP=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
commandString="curl http://textbelt.com/text -d number=1111111111 -d \"message=$myIP\""
$(eval $commandString)
#call this script from /etc/rc.local with (eval "/path/to/thisscript"); get a text every time your machine reboots with the new IP.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment