#!/bin/sh
#Script to check public IP, and check to see if it changed
#WTFismyip goes down after too many requests
#Kris Wood
ip_old='/tmp/text.1/text'
ip_new='/tmp/text.2/text'
ip_tmpmail='/tmp/iptmpmail/Woodiiiii.txt'
i=0
i2=3
while [ $i != $i2 ];
do
if [ -f $ip_old ];
then
read $ip_test_old < $ip_old
wget -P/tmp/text.2/ http://wtfismyip.com/text
read $ip_test_oldd < $ip_new
if ["$ip_test_old" == "$ip_test_oldd"]
then
echo "Match!"
else
echo "Event date: " $date > $ip_tmpmail
echo "IP CHANGE! IP Was changed to: " $ip_test_oldd >> $ip_tmpmail
/bin/mail -s "IP Address" "root" < $ip_tmpmail
rm $ip_tmpmail
fi
else
echo "Welcome to the IP checker! N00b"
wget -P/tmp/text.1/ http://wtfismyip.com/text
echo "Event date: " $date > $ip_tmpmail
echo "Welcome to the IP checker! N00b" >> $ip_tmpmail
/bin/mail -s "Ip address" "root" < $ip_tmpmail
rm $ip_tmpmail
fi
sleep 3
done
#Kris Wood