Linux IP Checker script v1.2


SUBMITTED BY: Guest

DATE: Nov. 30, 2013, 8:22 p.m.

FORMAT: Text only

SIZE: 1.1 kB

HITS: 834

  1. #!/bin/sh
  2. #Script to check public IP, and check to see if it changed
  3. #WTFismyip goes down after too many requests
  4. #Kris Wood
  5. ip_old='/tmp/text.1/text'
  6. ip_new='/tmp/text.2/text'
  7. ip_tmpmail='/tmp/iptmpmail/Woodiiiii.txt'
  8. i=0
  9. i2=3
  10. while [ $i != $i2 ];
  11. do
  12. if [ -f $ip_old ];
  13. then
  14. read $ip_test_old < $ip_old
  15. wget -P/tmp/text.2/ http://wtfismyip.com/text
  16. read $ip_test_oldd < $ip_new
  17. if ["$ip_test_old" == "$ip_test_oldd"]
  18. then
  19. echo "Match!"
  20. else
  21. echo "Event date: " $date > $ip_tmpmail
  22. echo "IP CHANGE! IP Was changed to: " $ip_test_oldd >> $ip_tmpmail
  23. /bin/mail -s "IP Address" "root" < $ip_tmpmail
  24. rm $ip_tmpmail
  25. fi
  26. else
  27. echo "Welcome to the IP checker! N00b"
  28. wget -P/tmp/text.1/ http://wtfismyip.com/text
  29. echo "Event date: " $date > $ip_tmpmail
  30. echo "Welcome to the IP checker! N00b" >> $ip_tmpmail
  31. /bin/mail -s "Ip address" "root" < $ip_tmpmail
  32. rm $ip_tmpmail
  33. fi
  34. sleep 3
  35. done
  36. #Kris Wood

comments powered by Disqus