Send email notifications on IP address change

I recently discovered that my home IP address is not as static as I would like. This will prove a problem if it changes while I'm away from home, so I needed to find a way to get updates on the IP if and when it changes. I threw together a quick bash script that I could run regularly with my server's cron daemon. Any time the IP address changes, it emails the provided email with a customizable message that includes both the old and new IP's.


#Path to where you want the ip address file stored
#Destination email address
#Email body. Don't remove the inner double quotes, and remember to properly escape any single quotes
EMAIL_MSG=$'"This server'\''s IP address appears to have changed from $OLDIP to $IPADDR. Might be time to update your DNS!"'
#Email Subject
EMAIL_SUB="Server Alert: IP Address Change"

#Function: sends the email when called. Requires that you actually have mail configured to use a mail client.
email_alert ()
echo "$IPADDR" > "$IP_PATH"
echo "$EMAIL_MSG" | mail -s "$EMAIL_SUB" "$EMAIL_DEST"


#Grab our current IP address and do a quick sanity check
IPADDR=$(curl -s | grep -m 1 -o --regexp="[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}")

#Compare current IP to old IP and take appropriate actions
if (( ${#IPADDR} > 7 ))
if [ -e "$IP_PATH" ]
if [ "$IPADDR" != "$OLDIP" ]

Geocaching, A Beginning

Have you heard of Geocaching? If you have a GPS device, you could even participate! According to, geocaching is,

Geocaching is a high-tech treasure hunting game played throughout the world by adventure seekers equipped with GPS devices. The basic idea is to locate hidden containers, called geocaches, outdoors and then share your experiences online. Geocaching is enjoyed by people from all age groups, with a strong sense of community and support for the environment.

Sound like fun? I thought so. Last night I found my first Geocache at N 40° 21.338 W 94° 53.816. Do you know where that is? No? Huh… Well, if you’re in Maryville, you probably don’t know you do know where it is! :) After finding my first cache, I rode my bike a while and saw both the water tower on campus draining, and a SKUNK on campus! Pics are on flickr. (Wordpress is still mangling my pics…)