Check your IP periodically with a small shell script

July 2, 2009

For those who are subject to dynamically assigned DSL IP, you would probably be familiar with a site such as

Here is a small script I use to fetch my public IP for other script processes

updated “due to changes on the site, I rewrote the script”


link=lynx -dump -listonly '' | awk -F: '/ && $0 != "" { getline; print $0}' | awk -F " " {'print $2'} curl -s $link | grep ‘“Box”’ | egrep -o ‘[0-9.]+’

curl -s | grep ‘“Box”’ | egrep -o ‘[0-9.]+’

You may run it in a cron and email you your IP whenever it changes from the last fetch one and update your firewall rules accordingly…