About: This is a small shell script which I schedule with cron to email me when my Public IP address changes.
#!/bin/bash
cd /root/DyIP/
currentip=`wget -qO- whatsmyipaddress.com | grep "<title>Your IP Address" | awk '{print $5}' | sed 's/</title>//g'`
new=0
if [ -f /root/DyIP/savedip.txt ]
then
new=1
fi
if [ $new = '0' ]
then
echo $currentip > /root/DyIP/savedip.txt
fi
file=`cat /root/DyIP/savedip.txt`
if [ $currentip = $file ]
then
echo "Same Address"
else
echo $currentip > /root/DyIP/savedip.txt
cat /root/DyIP/savedip.txt | mail email@email.com
fi

