just out of curiosity, why would you fire off an email if the address
changed?  Why not trigger another script that will modify the appropriate
DSN database file, then restart the named service?  Wouldn't that make your
changes more dynamic, and efficient (i.e. no waiting for a human to do
something).

Just curious.

Shawn

-----Original Message-----
From: Kevin Anderson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 11, 2003 4:06 PM
To: [EMAIL PROTECTED]
Subject: Re: (clug-talk) Dynamic DNS help?


create the original file

ifconfig eth0|grep inet > test

then in the cronjob

ifconfig eth0|grep inet > test1

compare them

diff test test1 > test2

Someone better at scriptiong than me will have to correct this.

if [ "cat test2" = "" ]; then
    echo no change
else
    mail [EMAIL PROTECTED] < test2
    rm -f test
    cp test1 test
fi

from the top of my head.  Now as I indicated, I know for sure that the IF
statement is wrong.  Either someone else will rewrite, or google will help
you.

That should work.

:)

And now you know why I don't write code.

Kev.




----- Original Message -----
From: "Jesse Kline" <[EMAIL PROTECTED]>
To: "CLUG TALK" <[EMAIL PROTECTED]>
Sent: Tuesday, February 11, 2003 12:38 PM
Subject: RE: (clug-talk) Dynamic DNS help?


> On Tue, 2003-02-11 at 10:47, Curtis Sloan wrote:
>
> > Thus I poked around dhcpcd to see if it would let me know when it
> > makes/receives a change in address (dhcpcd as an example, other DHCP
clients
> > exist).  If anyone knows a better tool/way, I'd love to hear it.
>
> Looking through my own personal archive I found some messages from back
> in November when I was complaining that I couldn't ssh into my box
> because my IP address had changed. Here are the responses that I got:
> Kevin Anderson wrote:
> "Create a cronjob that:
>
> writes your IP address to a file called current every hour.
> Compare the contents of current with the contends of old.
> if they are different, then mail [EMAIL PROTECTED] < current
>     copy current over old
> end
>
> Then create the original old file for yourself.
>
> Depending on how much you value SSH access, have it check hourly.
>
> Kev."
> This sounds like a good idea. I'm not quite sure how to implement this,
> but if the router has the public IP address then the cronjob could run
> ifconfig and pull the IP, then it shouldn't be too hard to compare two
> IP addresses and take action if they are different. I also got this
> response from Richi Plana:
> "Or, if you're using dhclient, modify the /sbin/dhclient-script script.
> There's a section there that actually handles a change in IP address.
> Just email the contents of $new_ip_address to your external mail
> account."
> This one may relate more directly to what you are trying to do.
>
> I hope this helps,
>
> Jesse
>
>
>

Reply via email to