detect changed WAN ip address

  • 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

    Code
    touch /media/hdd/my_ip.txt


    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!



    I get an error [3.4.5.6: not found (address changed for demonstration purposes)

  • try this


    Code
    if [ "$WANIP" != "$old_ip" ] ; then


    the blanks before/behind [] are necessary and the arguments between ""


    this syntax works in all my scripts on the dream

    Gruß Fred


    Die Dreambox ist tot, es lebe die Dreambox


    2 Mal editiert, zuletzt von Fred Bogus Trumper ()