Created
October 24, 2014 22:27
-
-
Save markcaudill/03c0928b510bd5db8f3a to your computer and use it in GitHub Desktop.
This file contains 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 | |
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