Nifty script! Thanks, Adam. I've been wanting a script to do just this for a
while. I kept looking for some low level C library call to detect the
current IP instead of just making it work. :)

Does anybody know of such a C network library call, BTW?

Thanks,
John Hebert

-----Original Message-----
From: Adam J. Melancon
To: [email protected]
Sent: 10/14/03 11:05 AM
Subject: Re: [brlug-general] Email - Clear Text - help???

I had a dynamic dns service at one time, but now I use a script to tell
me 
if my ip has changed.  It runs about ever 5 minutes using cron.

[EMAIL PROTECTED] bin]# cat checkip.sh
#!/bin/bash
# I have this program running in /etc/crontab with the following 
configuration:
# *       *       *       *       *       root    /usr/local/bin/newip
#
date=`date`

ifconfig eth0 | grep "inet " | cut -f12 -d" " > /usr/local/bin/.newip

if diff /usr/local/bin/.newip /usr/local/bin/.currentip;
then

          exit 0;

else
         cat /usr/local/bin/.newip > /usr/local/bin/.currentip;
         cat /usr/local/bin/.currentip > /usr/local/bin/.report
         date >> /usr/local/bin/.report
         mail -s "New IP  on $date"[EMAIL PROTECTED] < 
/usr/local/bin/.report;
         echo "different ip"
         rm -f /usr/local/bin/.report
         exit 0
fi
[EMAIL PROTECTED] bin]#



Adam J. Melancon

_________________________________________________________________
See when your friends are online with MSN Messenger 6.0. Download it now

FREE! http://msnmessenger-download.com


_______________________________________________
General mailing list
[email protected]
http://brlug.net/mailman/listinfo/general_brlug.net

Reply via email to