John,

You looking for something like this?

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=adamg8%24kmo%241%40star.cs.vu.nl&rnum=2&prev=/groups%3Fq%3Dlinux%2Bc%2Bcode%2Bip%2Baddress%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3Dadamg8%2524kmo%25241%2540star.cs.vu.nl%26rnum%3D2

I think you're looking for something like Frank Becker's (response 2) or David 
van Moolenbroek's approach (response 7), Joshua Jones' approach (response 6) 
uses a system call to ifconfig.

James

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of John Hebert
Sent: Tuesday, October 14, 2003 11:06 AM
To: '[email protected] '
Subject: RE: [brlug-general] Email - Clear Text - help???


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

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

Reply via email to