Skip to content

Instantly share code, notes, and snippets.

@markcaudill
Created October 24, 2014 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save markcaudill/03c0928b510bd5db8f3a to your computer and use it in GitHub Desktop.
Save markcaudill/03c0928b510bd5db8f3a to your computer and use it in GitHub Desktop.
#!/bin/bash
LAST=/tmp/last_public_ip
NOTIFY="you@domain.tld"
ip=$(curl -s https://mrkc.me/ip)
if [[ ! -e $LAST ]] || [[ "$ip" != "$(cat $LAST)" ]]; then
cat $LAST
echo -n "$ip" > $LAST
mail -s "New Public IP" $NOTIFY < $LAST
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment