1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Trying to edit options.pptp

Discussion in 'Sveasoft Firmware' started by siverson, Jul 18, 2004.

  1. siverson

    siverson Network Guru Member

    I'm trying to edit the /tmp/options.pptp file so that I can change the ms-dns setting and have it point to my local DNS server. It seems to save and works fine until the router reboots and it reverts back to the original setting. Is there a way I can make this setting stick even after a reboot?

    Thanks....
     
  2. Toxic

    Toxic Administrator Staff Member

    would a "nvram commit" help?
     
  3. littlewhoo

    littlewhoo Network Guru Member

    You can't make the changes permanent, but you could upload the changed file to a webserver and let the router automatically re-download it on every reboot.
    To do this you'll have to assign the script responsible for downloading to the rc_startup nvram parameter. In the WRT54G Web configuration go to Administration -> Diagnostics -> Run and enter the folling script in the textbox at the top of the popup-window.

    Code:
    #!/bin/sh
    if [ ! -f /tmp/options.pptp ]; then
    sleep 10
    /usr/bin/wget -O /tmp/options.pptp http://www.yourwebserver.de/options.pptp 2> /tmp/wgeterr &
    fi
    and hit the "Save Startup" button (don't forget to replace www.yourwebserver.de with the correct URL/path of your webserver).
    There is no line break after "/usr/bin/wget -O /tmp/options.pptp". "http://www.yourwebserver.de/options.pptp 2> /tmp/wgeterr &" must be in the same line.

    littlewhoo
     
  4. siverson

    siverson Network Guru Member

    nope...tried the "nvram commit" already....
     
  5. siverson

    siverson Network Guru Member

    Thanks for the quick help! I tried the script, but it doesn't seem to work. There is no error file and the options.pptpd file is the original after a reboot. Here is what I have for my rc_startup:

    Code:
    #!/bin/sh
    if [ ! -f /tmp/pptpd/options.pptpd ]; then
    sleep 10
    /usr/bin/wget -O /tmp/pptpd/options.pptpd http://192.168.0.4/~siverson/options.pptpd 2> /tmp/pptpd/wgeterr &
    fi
    
    I tried the wget command from a command prompt and it worked perfectly, so I know the webserver is serving the file correctly.

    Any ideas?
     
  6. siverson

    siverson Network Guru Member

    I managed to come up with a way to make the change without using an external web server.

    Code:
    #!/bin/sh
    sleep 10
    cd /tmp/pptpd
    mv options.pptpd options.pptpd.old
    sed 's/192.168.0.1/192.168.0.4/g' options.pptpd.old > options.pptpd
    rm -f options.pptpd.old
    done
    
    Thanks for the help!
     
  7. littlewhoo

    littlewhoo Network Guru Member

    Edit: Seems, that I was a little bit too late :) . Such small changes can of course be directly made in rc_startup


    Strange, I'm using this script for downloading some stuff to my router on every reboot and it's working perfectly.

    Perhaps you should first try a more minimalistic version of the script to see, if it's downloading the file at all.

    something like

    Code:
    #!/bin/sh
    sleep 10
    /usr/bin/wget -O /tmp/pptpd/options.pptpd http://192.168.0.4/~siverson/options.pptpd > /tmp/pptpd/wgeterr 2>&1
    
    This way you'll get the stdout of wget, too and you can see, if wget is doing anything at all on reboot.

    Of course it's possible, that the router is creating the file options.pptpd at the end of the boot process and therefore overwriting the file just downloaded by wget. To avoid this, you could try to increase the sleep interval at the beginning of the script (perhaps sleep 30 or sleep 60).

    Though I don't know, if the boot process is stopped until rc_startup is completely executed. In this case increasing the sleep interval at the beginning of rc_startup would be quite useless.

    In this case you could download and start in the background another script with is downloading your options.pptpd file.

    Contents of rc_startup:
    Code:
    #!/bin/sh
    sleep 10
    /usr/bin/wget -O /tmp/pptpd/startup http://192.168.0.4/~siverson/startup > /tmp/pptpd/wgeterr 2>&1
    chmod 755 /tmp/pptpd/startup
    /tmp/pptpd/startup &
    contents of

    http://192.168.0.4/~siverson/startup

    Code:
    #!/bin/sh
    sleep 30
    /usr/bin/wget -O /tmp/pptpd/options.pptpd http://192.168.0.4/~siverson/options.pptpd > /tmp/pptpd/wgeterr 2>&1
    
    littlewhoo
     
  8. maple.chick

    maple.chick Networkin' Nut Member

    Thank for sharing the script. I was able to use it on DD-WRT .
     

Share This Page