How Can I save several lines for wanup script internally?

Discussion in 'Tomato Firmware' started by Yhazarus, Jan 22, 2018.

  1. Yhazarus

    Yhazarus New Member Member

    I have a lot of lines on wan up scripts which helping me playing online but I would like to store and execute then when wanup conditions are there without being in that section ,because my nvram is quite full
  2. Monk E. Boy

    Monk E. Boy Network Guru Member

    You can put the commands in a script in USB or JFFS and then link to the script in wanup.
  3. Yhazarus

    Yhazarus New Member Member

    How Can I do that, i'm a little newbee? Altough i was looking to save the changes in these confs freeing nvram
  4. eibgrad

    eibgrad Network Guru Member

    Open a shell (telnet/ssh) to the router using Putty. Type the following:

    cat > /jffs/
    The cursor will be to the far left, waiting for input. You can either type the command(s) into that window, or copy then paste using either Shift-Insert or right click, then Ctrl-C to close the file.

    Finally mark it executable.

    chmod +x /jffs/
    You can have the wanup script execute it by simply referencing it.

    P.S. Make sure the first line of any bash script has the shebang.

  5. eibgrad

    eibgrad Network Guru Member

    Another way to do it (which might be simpler for Tomato users) is to use Tools->System Commands and execute the following script.

    cat << EOF > /jffs/
    <your script goes here>
    chmod +x /jffs/
    Everything between the cat command and EOF will become part of the file.
    Monk E. Boy likes this.
  6. Yhazarus

    Yhazarus New Member Member

    I'm afraid of on my router wnr3500lv2 on shibby i haven't jffs partititon
    I have also shibby 1.40
    Last edited: Feb 12, 2018
  7. eibgrad

    eibgrad Network Guru Member

    Well there's only three viable options.

    1. Use nvram (implicit when you use the WAN UP script)
    2. Use jffs.
    3. Use USB.

    The only other possibility I see is storing them OFF the router on a server, then using a CIFS client (see Administration->CIFS Client) to connect to that server and read them into the router. The problem however is the timing. WAN UP will likely occur before the CIFS client can be established. But you can always try.
  8. eibgrad

    eibgrad Network Guru Member

    P.S. I suppose accessing a script from an internal (or even internet) webserver using wget/curl is another possibility as well. Maybe load it into /tmp as a file using the init script, and have that file referenced in the wan up script.
  9. Yhazarus

    Yhazarus New Member Member

    I suppose I can use nfs server from tomato,buyt i don't know how can i reference cript from wanup to that or usb,┬┐some adittional help?- you are really good guru of network,heh
    Could fill Nfs cost nvram space ?
  10. eibgrad

    eibgrad Network Guru Member

    I've never used the NFS server, but presumably it uses nvram, the same as jffs. So you're right back to where you started. Without nvram or USB, your only viable option is to grab the script from external storage.

    For example, you could store the file on a local webserver (use HFS is you have to,, read the file using wget (or curl), and execute it by placing the following in the WAN Up script.

    wget -qO - | sh
    I'm assuming is the LAN ip of the webserver.

    Or you could use the ftp protocol if you have an FTP server somewhere on the LAN.
  11. Yhazarus

    Yhazarus New Member Member

    thnaks for helping me
    I can use usb,but it dont know how can be formatted and reference there in wan up

    PD have only 3'82 percent of 32kb of nvram implications on performance?
  12. Monk E. Boy

    Monk E. Boy Network Guru Member

    If you have a flash drive you don't mind dedicating to the router I wrote up some step by step instructions a while back about partitioning and formatting drives on the router over ssh or telnet.

    If you follow those instructions it will completely wipe a drive (back up any data you want to keep first!) and put it into ext3 format which is Linux native.

    I use those micro drives that only stick out a little way, and 4GB is gobs of space for most things router based (including entware/optware). There are ways to connect ext2/3/4 to Windows but its probably easier and less problematic just to reboot into a live linux environment (using either an optical drive or another flash drive) if you find yourself needing to work with it on your system. About the only time I do that is if it stops mounting and I want to run fsck on it to fix whatever damage the local &*@#($&*( power monopoly caused, but I suppose if you wanted to copy files onto or off it then that would be a safe way of interacting with it. Though really you probably should just use SCP over SSH, it's less of a headache.
    Last edited: Feb 14, 2018
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice