I am trying to emulate dyndns
my son has a dreambox - remote from me - which I want to administer
his router can only deal with a dyndns.org account
dyndns now charge $20 a year for a domain name of n.dyndns.org
so - I thought it would be easy to write a script
the script should read a file from the hard disk, which contains the old wan ip address
get the new ip address from the automation web site
compare the two - if different, save the new ip address and then scp the file to my dreambox
sounded easy.
first off - created the text file with
then got the current ip address and wrote it to the file
Code
WANIP=`wget -q --output-document=- "http://automation.whatismyip.com/n09230945.asp"`
echo $WANIP > /media/hdd/my_ip.txt
now the script file - having problems with this!
Bash
#!/bin/sh
WANIP=`wget -q --output-document=- "http://automation.whatismyip.com/n09230945.asp"`
#WANIP='24.23.22.11' # change the address, so I can test that the wan address has altered
echo wanip = $WANIP
old_ip=`cat /media/hdd/my_ip.txt`
echo $old_ip
if [$WANIP <> $old_ip]; then
echo $WANIP > /media/hdd/my_ip.txt
#scp to go here
fi
exit 0
Display More
I get an error [3.4.5.6: not found (address changed for demonstration purposes)