View Single Post

  #1 (permalink)  
Old 07-11-2007, 06:39 AM
SAYAYINX SAYAYINX is offline
Junior Member
User
 
Join Date: Jul 2007
My distro: Ubuntu
Posts: 5
Rep Power: 0
SAYAYINX is on a distinguished road
Send a message via AIM to SAYAYINX Send a message via Yahoo to SAYAYINX
Cool Automatic IP change notifier

Hello everyone,

First of all thank you for reading this post!

Ok, here it goes:

What do I wanna create?
Answer: I want to create a bash script that checks my IP, and if there has been a change, send me an email, sms or automatically post the IP in a website.

Why should I? There are scripts such as no-ip.org, etc..
Answer: Even though I am using those as a guide, the truth is I want to make it better! Any help would be highly appreciated.

What have you done so far?
Answer: So far, this is all I got but it does not work!

#!/bin/bash
# The ultimate solution to my DNS problem
LOOKUP=`host subdomain.mydomain.com | awk '{print $4}'`
MYIP=`curl -s IP Chicken - What is my IP? Find Your IP Address! | awk '/[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*/ {print $1}'`
# Do the work
if [ "$LOOKUP" = "$MYIP" ]; then
echo "No change in your IP."
else
echo "The IP address has changed. "
#Either send me an: email, sms or post it in a site.
#mail -s "Here is the IP ... " username@mydomain.com
#echo `lynx -auth=${USERNAME}:${PASSWORD} -source "http://subdomain.mydomain.com"`
fi


What seems to be the problem is that the host command has some extra information that does not allow it to make a good comparison, so I always get the message that it has change.

Please help me out, I'm a quick learner!

~Saya
Reply With Quote