Install sendEmail. It's a lightweight, command line SMTP email client. We'll use it to send emails from a script, using a Gmail account.
sudo apt-get install sendemail libio-socket-ssl-perl libnet-ssleay-perl
Create the script
Create a file named "ip-notify.sh" somewhere, for example in a "Scripts" directory in your home folder; make it executable, and open it up for editing.
mkdir -p ~/Scripts && touch ~/Scripts/ip-notify.sh && chmod a+x ~/Scripts/ip-notify.sh && gedit ~/Scripts/ip-notify.sh
Insert the following text in the file:
# Modify the following values!
SENDERNAME="Computer" # This is the name that will show in the 'From' field. Purely esthetic.
RECIPIENTNAME="Your Name" # This is the name that will show in the 'To' field. Also purely esthetic.
GMAILADDRESS="firstname.lastname@example.org" # This is your Gmail address.
GMAILUSER="someemail" # This is your Gmail username, without the '@gmail.com' part.
GMAILPASS="password" # This is your Gmail password.
# You can stop modifying here
if [[ $(find $DIR -mmin -2 -name $CURIP) ]];
echo "$CURIP has been modified in the last two minutes."
# Send an email
sendemail -u "IP Address" -m "IP address has changed!" -f "$SENDERNAME <$GMAILADDRESS>" -t "$RECIPIENTNAME <$GMAILADDRESS>" -s $SMTPSERVER -xu $GMAILUSER -xp $GMAILPASS -a $DIR$CURIP $IPLOG
Once that's done, save and close the file.
Run the script periodically
We'll run this script every two minutes. Open up your crontab.
Add the following line to the bottom of the file:
*/2 * * * * bash ~/Scripts/ip-notify.sh
If all goes well, you should now get email updates when the IP address of your machine changes.