Loading ...
Sorry, an error occurred while loading the content.

Re: [nslu2-linux] Re: Script is driving me wild, any ideas?

Expand Messages
  • Jean jacques Goessens
    I got the same problem while changing my passords with a windows box, impossible to telnet it, because the end of line was /bin/sh ! I corrected it quickly
    Message 1 of 6 , Dec 4, 2005
    • 0 Attachment
      I got the same problem while changing my passords with a windows box, impossible to telnet it, because the end of line was /bin/sh<CR> ! I corrected it quickly with Midnight Commander on a linux box !
      NEVER EDIT SYSTEM FILES ON A WIN BOX!
       
      Here is my script, working, basically the same, but i added a feature in order to write a log file...
      I works since one month now..
       
       #!/bin/sh
       
      # etape 1 : trouver l'adresse ip actuelle / get actual IP
      wget -q http://checkip.dyndns.org/index.html --output-document=/opt/var/dnsupd/get.ip
      # formattage adresse
      cat /opt/var/dnsupd/get.ip | sed -e 's/[A-Z,a-z,>,<, ,/,\,:]//g'
      >/opt/var/dnsupd/new.ip
       
      # etape 2 : mettre jour au besoin / update if necessary
      if [ "$(cat /opt/var/dnsupd/new.ip)" = "$(cat /opt/var/dnsupd/old.ip)" ]
      then echo $(date +%d/%m/%y-%X) : adresse ip inchangee >> /opt/var/dnsupd/dnsupd.log else wget -q http://<IDENTIFIANT>:<MOT DE PASSE>@.../nic/update?hostname=goessens.dyndns.org --output-document=/opt/var/dnsupd/upd.ip echo $(date +%d/%m/%y-%X) : nouvelle adresse ip : $(cat /opt/var/dnsupd/upd.ip | sed -e 's/[A-Z,a-z,>,<, ,/,\,:]//g') >> /opt/var/dnsupd/dnsupd.log;  
      rm /opt/var/dnsupd/upd.ip
      fi
      rm -f /opt/var/dnsupd/old.ip
      mv /opt/var/dnsupd/new.ip /opt/var/dnsupd/old.ip
       
       
      Jean jacques, Unslung 5.5 133MHz
      ----- Original Message -----
      Sent: Sunday, December 04, 2005 8:29 AM
      Subject: [nslu2-linux] Re: Script is driving me wild, any ideas?

      --- In nslu2-linux@yahoogroups.com, "bloedmann999"
      <Brian_Dorling@t...> wrote:

      > Another strange thing happens. After the WGET to update the DNS, i
      > have a file called "/var/tmp/upd.ip?", if I cat it, then I can see the
      > contents. With ls it shows as "/var/tmp/upd.ip", in midnight commander
      > it shows as "/var/tmp/upd.ip?", if i try to cat "/var/tmp/upd.ip" than
      > i get an error. But, "cat /var/tmp/upd.ip?" works OK

      Did you happen to edit your script on a Windows box?  I bet you got a
      CRLF line ending on the wget line, and wget's output is being
      redirected into /var/tmp/upd.ip<CR>.





      ---------------------------------------------------------------------------------------
      Wanadoo vous informe que cet e-mail a ete controle par l'anti-virus mail.
      Aucun virus connu a ce jour par nos services n'a ete detecte.


    • bloedmann999
      Codewhacker, yes dead on. What threw me was that mc on my debian box will show such CRLFs, but mc on the slug does not (haven t found out why, yet)!. Thanks
      Message 2 of 6 , Dec 4, 2005
      • 0 Attachment
        Codewhacker,
        yes dead on. What threw me was that mc on my debian box will show such
        CRLFs, but mc on the slug does not (haven't found out why, yet)!.
        Thanks again for the tip.

        Cheers Brian


        --- In nslu2-linux@yahoogroups.com, "codewhacker" <roy@r...> wrote:
        >
        > --- In nslu2-linux@yahoogroups.com, "bloedmann999"
        > <Brian_Dorling@t...> wrote:
        >
        > > Another strange thing happens. After the WGET to update the DNS, i
        > > have a file called "/var/tmp/upd.ip?", if I cat it, then I can see the
        > > contents. With ls it shows as "/var/tmp/upd.ip", in midnight commander
        > > it shows as "/var/tmp/upd.ip?", if i try to cat "/var/tmp/upd.ip" than
        > > i get an error. But, "cat /var/tmp/upd.ip?" works OK
        >
        > Did you happen to edit your script on a Windows box? I bet you got a
        > CRLF line ending on the wget line, and wget's output is being
        > redirected into /var/tmp/upd.ip<CR>.
        >
      • Brian Wood
        Agreed, in general. But if for some reason you *have* to, use the free cygwin environment, where you can use your favorite unix editor (vi, emacs etc.).
        Message 3 of 6 , Dec 4, 2005
        • 0 Attachment

          Agreed, in general.

          But if for some reason you *have* to, use the free cygwin environment, where you can use your favorite unix editor (vi, emacs etc.).

          On Dec 4, 2005, at 3:12 AM, Jean jacques Goessens wrote:

          I got the same problem while changing my passords with a windows box, impossible to telnet it, because the end of line was /bin/sh<CR> ! I corrected it quickly with Midnight Commander on a linux box !
          NEVER EDIT SYSTEM FILES ON A WIN BOX!
           

        • Attila Csipa
          ... IIRC You even have a native version of VIM for windows (you don t even need cygwin), although VIM will not get many sympathies in a click-your-way-through
          Message 4 of 6 , Dec 4, 2005
          • 0 Attachment
            On Sunday 04 December 2005 15:56, Brian Wood wrote:
            > But if for some reason you *have* to, use the free cygwin
            > environment, where you can use your favorite unix editor (vi, emacs
            > etc.).

            IIRC You even have a native version of VIM for windows (you don't even need
            cygwin), although VIM will not get many sympathies in a
            click-your-way-through windows world :)
          Your message has been successfully submitted and would be delivered to recipients shortly.