Posted: Thu Feb 12, 2015 18:08 Post subject: 32k nvram help
Hi,
I am trying to stay below the 32k mark as suggested. When I set my vpn up it takes me to 34k, any suggestions how I can lower it. The whole purpose was to use with my vpn.
Joined: 13 Mar 2014 Posts: 856 Location: Montreal, QC
Posted: Thu Feb 12, 2015 20:55 Post subject:
How does
nvram show | grep =$ | wc -l
benefit the user when added to a script as all it does is count the number of empty variables? It would seem to me that it has no baring on the next command, the result is not visible when run in a script and takes up additional nvram space when added to any of the administration -> commands section.
I did a factory reset and re ran the script brought it back down to 24. The VPN script replaces this one I think is the issue. need to find out if there is a way to run multiple start up scripts.
Joined: 13 Mar 2014 Posts: 856 Location: Montreal, QC
Posted: Thu Feb 12, 2015 21:33 Post subject:
Biller007 wrote:
I did a factory reset and re ran the script brought it back down to 24. The VPN script replaces this one I think is the issue. need to find out if there is a way to run multiple start up scripts.
I don't see any issue with adding those lines to the beginning of your VPN script. What it does is parse your nvram variables looking for null variables and deletes them (unset). If you were to run that command twice, the second time it would do absolutely nothing as there are no more nvram null variables
I can't see any problems so long as nothing is dependent on the existence of a nvram variable even if it is null.
Joined: 04 Jan 2007 Posts: 11563 Location: Wherever the wind blows- North America
Posted: Thu Feb 12, 2015 21:34 Post subject:
JAMESMTL wrote:
How does
nvram show | grep =$ | wc -l
benefit the user when added to a script as all it does is count the number of empty variables? It would seem to me that it has no baring on the next command, the result is not visible when run in a script and takes up additional nvram space when added to any of the administration -> commands section.
Am I missing something?
I'll be honest...I'm rather inept when it comes to scripting...however, I know I got a ton of errors when I tried to run without the "nvram show | grep =$ | wc -l" included.
I suppose this line may not be necessary...but I'm just providing feedback from my personal experience.
redhawk _________________ The only stupid question....is the unasked one.
Assumptions:
1. Everyone on the forum has read the relevant forum section announcements.
2. For Broadcom section we have ALL at least tried to understand the "Peacock" thread,HERE
if u have problem with nvram space u can always move vpn certs and settings from nvram to jffs its not so complicated after all. I posted semi-tutorial how to move vpn server ( for client most steps are same ) from nvram to jffs maybe this will help
Joined: 13 Mar 2014 Posts: 856 Location: Montreal, QC
Posted: Thu Feb 12, 2015 23:33 Post subject:
Actually running those commands will reduce nvram usage during runtime. Adding your vpn script via webif startup script will add it to nvram, possibly overrunning nvram at boot.
I believe your router has USB ports, if so why not add a cheap USB key with a jffs partiton. Enable ddwrt usb support, usb storage, and auto mount. Then save your script to /jffs/etc/config. Add .startup extension and make it executable. Ddwrt will then run it after every boot and use no additional nvram space.
As an added benefit of running scripts from external storage, should a script misbehave and cause a boot loop, you can just remove usb drive before boot.
Joined: 13 Mar 2014 Posts: 856 Location: Montreal, QC
Posted: Fri Feb 13, 2015 2:53 Post subject:
1. Create a linux partition (ext 2 or 3) on the drive named jffs. I use a GParted live cd but there are various windows programs that can create linux partitions
2. Plug the USB key / drive into the router
3. In ddwrt go to services -> usb and enable core support, then usb storage and auto-mount
Apply and Reboot then return to services -> usb and you should see /jffs on page
4. If not already enabled, enable ssh
5. Install winscp on your computer. This will allow you to browse the router filesystem and to transfer files
6. Create a blank file on pc called something like vpn.startup
7. Edit that file with notepad ++ (DO NOT USE windows notepad)
The first line of the file must be
#!/bin/sh
Paste your script after this line
Save
8. Open winscp and connect to router (user=root,password=your regular password)
Off the root dir you should see a /jffs dir
Create subdir called "etc" if it doesn't exist
From within etc create subdir "config"
copy your script to /jffs/etc/config
Right click on the file and select properties
Set owner privilege X (executable)
Reboot. From this point on your script should run on every startup