What's new

User NVRAM Save/Restore Utility (R26.2)

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Status
Not open for further replies.
Sorry for the quick update....

Version 12 1-February-2015
- do not hardcode jffs restore directory parent
- add nvram variable identifying previous buildno
- improved logic for code specific restores
- add call to user exit script, nvram-user.sh, for custom processing
- updated QuickStart for user script (Advanced Users)

Full Changelog is available in download directory
nvram-save-r12.zip
http://1drv.ms/16pENHc
-----------------------------------------------------------------

This release adds a call to a user exit script where you can do further processing on the saved files (for example, create a tar backup). It also improves restores where both the come from and go to levels are both 378 or above code levels (avoids unnecessary processing).
 
Thank you for this excellent script, I was searching something like this from a while.
May I suggest to create a bzip2 archive at the end of the save script?
Something like:

Objective is to create an uniq file archive.

Anyway, excellent work!

I'm trying to keep things as simple as possible for all users, so not included in the base function.

But, I did add a user script option where you can add this function if you want (BTW, bzip2 isn't included in the firmware build, you have to use gzip).
Documented at the end of the QuickStart under 'Advanced Users'.
 
I think this thread should be sticky...
 
Hi,

First thanks john9527 for a great script! :)

I suspect I've found a small bug in the nvram-save script.

After restoring my settings I noticed that I can't login using VPN pptp (merlin 478.50.beta2)

The culprit is that I have a $ sign in my password and it seems to get interpreted by the shell because the use of "weak quotes".

Example:

$ nvram set pptpd_clientlist="<myuser>abc$123"

$ nvram get pptpd_clientlist
<mysuser>abc

while using "strong quotes"

$ nvram set pptpd_clientlist='<myuser>abc$123'

yields the correct result.

I guess the securest way to is to use "strong quotes" but the strange thing is that it worked before...
When looking at old backups It worked until some nvram upgrade (maybe version 8 or 9) or is it the shell that has become more capable in the latest merlin 478.50.beta2?

Anyone else having problems with this?

Thanks in advance,

Michael
 
Please make sure you are using a recent version of the script....the '$' handling was fixed in Version 6 and later.

Right now the only way to check is to look inside the nvram-save.sh at the header. Next update I'll add a print of the version number during the execution.

Version 6
- save/restore correctly handles '$' in nvram variables
- Update QuickStart.txt to include current path in commands - thanks to longstaff
 
Is there a way to check in nvram-restore<*>.sh file which version of nvram-save that was used?

I haven't used the VPN so often :) So I guess the password might have got corrupted in earlier versions and I haven't noticed it during the upgrades.
 
Is there a way to check in nvram-restore<*>.sh file which version of nvram-save that was used?

I haven't used the VPN so often :) So I guess the password might have got corrupted in earlier versions and I haven't noticed it during the upgrades.

Unfortunately not...it's definitely going to be added :)

But the fix could be seen in the generated nvram-restore-yyyymmdd-macid.sh script. If you edit that script (in vi or a Linux compatible Windows editor) the '$' will be escaped to '\$' (you can add the backslash yourself to fix it up).

One other check....V6 was released on 05-December-2014. If the date of the restore script is earlier than that, it won't have the fix.
 
Very nice tool, i have tested v10 with merlin v50b1. When a backup/restore of openvpn is done, there is missing a part of the openvpn custom configuration string after the restore (i had to reenter the custom configuration manually in the gui).

Small bug, but the tool was very usefull for me anyway.
 
Very nice tool, i have tested v10 with merlin v50b1. When a backup/restore of openvpn is done, there is missing a part of the openvpn custom configuration string after the restore (i had to reenter the custom configuration manually in the gui).

Small bug, but the tool was very usefull for me anyway.

I actually spent extra time testing that since that variable contains spaces and linefeeds. Can you append the contents of your custom config section? Also, did you ever edit the nvram-restore script?
 
Last edited:
John9527:
I actually spent extra time testing that since that variable contains spaces and linefeeds. Can you append the contents of your custom config section? Also, did you ever edit the nvram-restore script?

For the restore, to make sure i restored only what i want, i kept only the openvpn complete section in the restore script (and the mandatory end of the script).

Here what looks like my custom openvpn configuration:

push "dhcp-option DNS xxx.xxx.xxx.xxx"

I don't remember exactly were the restore cut that string, but it was between 2 words (on a space?), but i am not sure...
 
I also think this thread should be a sticky or stand out in some way.

I used R9 a few weeks ago to upgrade from -45 to -49.5, and it worked great. However, I did have a couple of hiccups executing the process.

It seems to me that the final step in the restore instructions is missing something that will commit the restored settings. Several times I restored the settings but then restarted the router, and rebooting it flushed the settings out. Only after I restored the settings then clicked Apply were the settings saved. And for overkill probably, I clicked "Apply" on every major tab of the interface to be sure. Is there another command for the script that would take care of this issue? Or have I just missed seeing it in the thread (it should be with the Quick start instructions)?

And is there a way to copy the script into an attached USB drive folder over the LAN with Windows and keep it there for use with Telnet to save to and restore from that folder -- rather than moving a flash drive around?

Thanks! Great utility!
 
John9527:


For the restore, to make sure i restored only what i want, i kept only the openvpn complete section in the restore script (and the mandatory end of the script).

Here what looks like my custom openvpn configuration:

push "dhcp-option DNS xxx.xxx.xxx.xxx"

I don't remember exactly were the restore cut that string, but it was between 2 words (on a space?), but i am not sure...

Got it....it's the double quotes causing the problem. Thanks for the reporting it. Will have a fix in the next release.
 
I also think this thread should be a sticky or stand out in some way.

I used R9 a few weeks ago to upgrade from -45 to -49.5, and it worked great. However, I did have a couple of hiccups executing the process.

It seems to me that the final step in the restore instructions is missing something that will commit the restored settings. Several times I restored the settings but then restarted the router, and rebooting it flushed the settings out. Only after I restored the settings then clicked Apply were the settings saved. And for overkill probably, I clicked "Apply" on every major tab of the interface to be sure. Is there another command for the script that would take care of this issue? Or have I just missed seeing it in the thread (it should be with the Quick start instructions)?

The restore script does an 'nvram commit' at the end so everything should be saved to nvram. I don't think it would take long enough that you could reboot before it's finished, but I'll add a short delay to give it some extra time (make sure you see the 'Please reboot' message at the end of the restore).

And is there a way to copy the script into an attached USB drive folder over the LAN with Windows and keep it there for use with Telnet to save to and restore from that folder -- rather than moving a flash drive around?

Thanks! Great utility!

Sorry, but the script and data have to be on a drive local to the router. You can however share the flash drive via SAMBA and access it from Windows that way to copy files. Or, get a copy of WinSCP which will let you have the router flash drive directory side by side with a PC directory and drag and drop between them.
 
The script and data have to be on a drive local to the router.

That's really what I meant when I said "an attached USB drive folder" -- attached to the router's other USB port. I've had a small HDD running off my RT-N66 since the beginning, although I haven't really utilized it much. So I should be able to operate the utility from it and manage it using SAMBA from a Windows machine, correct? I just want to be sure I'm not spinning my wheels if I can't get it quite right the first time. Thanks!
 
That's really what I meant when I said "an attached USB drive folder" -- attached to the router's other USB port. I've had a small HDD running off my RT-N66 since the beginning, although I haven't really utilized it much. So I should be able to operate the utility from it and manage it using SAMBA from a Windows machine, correct? I just want to be sure I'm not spinning my wheels if I can't get it quite right the first time. Thanks!

Should work fine running from an attached USB drive. You will still need to telnet/SSH to the router to run the commands, but will need to adjust the command to change to the proper current working directory with the scripts. For example, instead of

cd /mnt/ASUS

it might be

cd /mnt/sda1/ASUS

if you put everything in an ASUS subdirectory on the first USB drive.

Also, just a reminder to be careful if you edit anything from the windows machine to keep things in Linux format vs DOS/Windows format.
 
I tried search before posting and kept ending up here in this thread. I am aware it's a script to backup nvram but I am looking for a quick terminal command to backup my static ips, and forwarded ports. Or a link to proper thread or post.

Thank you
 
Thank you I am ashamed, still running Firmware:374.40 on RT- N66U and would not update because I could not find this. Updating to current firmware instead of purchasing new router. And hanging out here more often.
 
Thank you I am ashamed, still running Firmware:374.40 on RT- N66U and would not update because I could not find this. Updating to current firmware instead of purchasing new router. And hanging out here more often.


No shame in learning. Just a suggestion for next time; don't use forum search tools. Just search in regular google with 'smallnetbuilder.com' at the end of your search terms. More likely to get a result to your real questions. ;)
 
Status
Not open for further replies.

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top