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)

  • thanks -I had changed the <> for !=
    but I wasn't aware of the spaces


    thanks again

  • 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

    Vorgehen für Wirbelin Internet-Foren bei Problemen:

    1. Problem erkennen
    2. Problem verstehen
    3. online nach Lösungen suchen
    4. Falls ein Lösungsvorschlag nicht funktioniert
      a) Alter des Betrages prüfen
      b) Thread fertig lesen
      c) Nach alternativen Lösungsvorschlägen suchen
    5. Lösungsvorschlag verstehen
    6. bei Unklarheiten im angemessenen Umgangston im Forum nachfragen
    7. Antworten lesen und verstehen und nicht immer gleich stänkern
    8. nicht immer mit jedem anlegen, weil nicht die gewünschte/erwartete Antwort geliefert wird


    Edited 2 times, last by Fred Bogus Trumper ().