get-extern-ip-addr.pl

Bill Mullen moon at lunarhub.com
Sat Mar 18 17:32:01 EST 2006


On Fri, 17 Mar 2006 13:08:52 -0500, Kevin D. Clark wrote:

> A little hack that I wrote to help a colleague keep track of how
> often his broadband IP changes.  I thought others might find this to
> be useful too.

Here's one of mine, which should work as long as the target site remains
available (and doesn't undergo a revamp - it still works fine more than
two years after I wrote it, so I suppose that's a good sign):

#!/bin/sh
# Prints external IP address to stdout
lynx -dump http://www.whatismyip.com 2>&1 | grep 'Your IP Is' | gawk '{
print $4 }'

Obviously, it could benefit from some logic to identify and report on
connectivity failures, if one were intending to use it in a cronjob as
you describe in yours; it fails silently, which works for my purpose.

-- 
Bill Mullen
RLU #270075



More information about the gnhlug-discuss mailing list