#!/usr/bin/perl -w

my $ip=`wget http://checkip.dyndns.org/ -O - -o /dev/null`;
$ip=~/(\d+\.\d+\.\d+\.\d+)/;
$ip=$1;
my $dns=`host YOURDYNDNS.dyndns.org`;
$dns=~/(\d+\.\d+\.\d+\.\d+)/;
$dns=$1;
my $URL="http://admin:YOURPASS@192.168.1.1/setup.cgi?todo=reboot";
if($ip ne $dns) {
  system("wget -q $URL -O /dev/null");
}