R7000 nvram backup script

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Goto page 1, 2, 3, 4  Next
Author Message
RjG
DD-WRT User


Joined: 01 Jul 2007
Posts: 81

PostPosted: Tue Mar 25, 2014 22:35    Post subject: R7000 nvram backup script Reply with quote
From the R7000 topic request
this is a simpler version of Frater's backup for local
USB that I use on my R7000.

origins:
http://www.dd-wrt.com/phpBB2/viewtopic.php?t=44324

This script is customized for R7000, Kong AC ARM,
for use on the USB drive, no additional packages required

Read the usage text file, step by step complete simple instructions inside.



Backup2017.rar
 Description:
Updated May 2017 for egrep

Download
 Filename:  Backup2017.rar
 Filesize:  9.83 KB
 Downloaded:  589 Time(s)


Backup17 How To.txt
 Description:

Download
 Filename:  Backup17 How To.txt
 Filesize:  3.69 KB
 Downloaded:  1054 Time(s)


_________________
DD-WRT v3.0-r40270M kongac Netgear R7000


Last edited by RjG on Wed May 17, 2017 7:28; edited 1 time in total
Sponsor
slidermike
DD-WRT Guru


Joined: 11 Nov 2013
Posts: 1487
Location: USA

PostPosted: Wed Mar 26, 2014 1:00    Post subject: Reply with quote
RJG,
thank you for taking the time to give the directions & scripts.
I followed yours & its been exactly as you stated.

I do have a couple questions.
When I do a dir of the backups directory I see 5 .sh files.
In your directions you say to restore, run the "preferred".
You also noted in the read me that with the new driver version from Kong (which I am running & plan on continuing to since for me they are solid). I would prefer NOT to have to rebuild my 4 wireless ssid's & associated configurations.

#1 Does "preferred" restore ALL settings or other than actually doing a restore, how can I tell what is & isn't restored?
#2 Can you briefly explain what each of the 5 backups does or does not restore?
#3 Does this backup script run automatically or should I run it after config changes manually?

Thank you for posting this.
So far so good.
Now I am waiting for the next Kong update that requires a reset.
Smile

_________________
Router currently owned:
Netgear R7800 - Router
Netgear R7000 - AP mode

R7000 specific Tips/Tricks.
http://www.dd-wrt.com/phpBB2/viewtopic.php?t=264152
RjG
DD-WRT User


Joined: 01 Jul 2007
Posts: 81

PostPosted: Wed Mar 26, 2014 5:41    Post subject: Reply with quote
slidermike, no problem

1 - Preferred catches pretty much all usually set stuff. The only setting of mine that isn't in Frater's latest is the block filters to keep the kids off the Xbox at 6AM Wink
Try it and see... if anything is missing for you, and if it really bugs you, try and find the settings by looking in ALL.SH , then add the relevant prefixes to VARS_PREFERRED so it backs those up next time. Be careful. The current list is verified safe, but what you add yourself is as risky as you want to make it. You likely won't find much, if anything missing though.

hint: ^wshaper means "back up anything that starts with wshaper" Read the files, the prefixes are very descriptive of what they are for.

2.
All.SH would be every setting in NVRAM. Run that and wreck stuff badly. It's there to find things that are missing as stated above.

DANGEROUS.SH is filled with settings that will BRICK a different hardware router if you run it on there.

MINIMAL will just get you going, I suppose. It doesn't have much in it.

PREFERRED is the named one you can add to, or remove things from, to customize the backup for yourself by editing vars_preferred. Put less settings in there, or more, it's up to you. Frater greatly expanded the list I originally made, it's pretty comprehensive.

Essential is a everything from ALL that doesn't fit into dangerous, would be my best description.

Really, when you reset the router to defaults, EVERYTHING that needs to be set, already gets set with defaults in the first couple minutes or so. Your "restore" script only needs to populate the custom stuff you want, to put the router back to where you had it set up before. It's to your advantage NOT to set stuff you don't need to in case the newer version uses different settings, or different variables, or BETTER defaults to fix something. Plus there's no point overwriting the values with the same ones that are likely already there. That's why I like the "PREFERRED" script. It's pretty much complete, but you can add or change what you want.


*PS - not kidding about NOTEPAD, use a not-unix friendly text editor on ANY file here and it will NOT work properly anymore. You could end up with a brick. Don't do it*

For the drivers, that's just a warning, only because it's a bit flakey right now from the transition... Keeping wl wl0 wl1 nvram settings probably won't make any difference at all, but that's a KONG question. I just didn't want to cause anyone problems in case it did. It would likely be fine though.

3.
No, it doesn't run automatically. You could set up a CRON job if you really want that, there's even a setting for CRON in the GUI under ADMIN:Management.

There's lots to read here: http://www.dd-wrt.com/phpBB2/viewtopic.php?t=44324 Smile
slidermike
DD-WRT Guru


Joined: 11 Nov 2013
Posts: 1487
Location: USA

PostPosted: Wed Mar 26, 2014 14:42    Post subject: Reply with quote
RjG,
Thank you for explaining the differences between the choices.

I will probably get into the variables in a month or so once I am not so busy & after I have restored to know exactly what to add for my particular build.

One more thing,
you mentioned adding a cron job in the gui & I see that.
What I am curious about, how would I go about telling the cron job to run once a week or month?


Thank you
Mike

_________________
Router currently owned:
Netgear R7800 - Router
Netgear R7000 - AP mode

R7000 specific Tips/Tricks.
http://www.dd-wrt.com/phpBB2/viewtopic.php?t=264152
RjG
DD-WRT User


Joined: 01 Jul 2007
Posts: 81

PostPosted: Wed Mar 26, 2014 16:46    Post subject: Reply with quote
I can't say exactly, I never tried the DD-WRT GUI cron setup either... you might have to research that one.

I'd guess be something along the lines of
(Once a week, monday @ 8AM)

0 8 * * 1 /tmp/mnt/sda1/BkpScript/backupessential

or maybe

0 8 * * 1 root /tmp/mnt/sda1/BkpScript/backupessential

?
NiTrus
DD-WRT User


Joined: 25 Dec 2010
Posts: 295
Location: Twin Cities, MN

PostPosted: Fri Mar 28, 2014 15:13    Post subject: Reply with quote
this script is the BOMB!!!
just tried it out, worked perfectly!!
even remembered traff data..

GREAT JOB!!

_________________
NETGEAR R9000 | RT | 40134
NETGEAR R7800 | AP | 40134

slidermike
DD-WRT Guru


Joined: 11 Nov 2013
Posts: 1487
Location: USA

PostPosted: Fri Mar 28, 2014 15:23    Post subject: Reply with quote
RjG,
I agree with Nitrus that the script & directions work great.

One last question.
When I run the back up as you suggest; does it automatically create the other backups I see listed in the backup folder?

_________________
Router currently owned:
Netgear R7800 - Router
Netgear R7000 - AP mode

R7000 specific Tips/Tricks.
http://www.dd-wrt.com/phpBB2/viewtopic.php?t=264152
RjG
DD-WRT User


Joined: 01 Jul 2007
Posts: 81

PostPosted: Fri Mar 28, 2014 15:55    Post subject: Reply with quote
Yes, the backups folder was empty when UNRAR'd onto your USB drive, what you see there now is yours.

Every time you run the script, it creates a full set of restore files, minimal.sh, essential.sh, preferred.sh, etc in this format:

ROUTERNAME.DATE.preferred.sh

( I hope you name your router, or that will just be "dd-wrt.xx.xx" LOL )

If you run it twice on the same day, it will overwrite the previous set, because it's the same date.

If you run it every day for a week, you will have 7 sets of backups.
RjG
DD-WRT User


Joined: 01 Jul 2007
Posts: 81

PostPosted: Fri Jul 25, 2014 21:13    Post subject: Reply with quote
Here's an update.

This script is more or less the same as before, but cleaned up, and it adds the BUILD number to the restore script FILE NAME.

So now it creates:
<RouterName>.<DDWrtBuild>.<Date>.<RestoreSet>.sh
example:
Beast.23900.07252014.essential.sh
Beast.23900.07252014.minimal.sh
Beast.23900.07252014.preferred.sh


If you have been trying to keep up with R7000 builds, you'll know why this could be handy Smile

If you are installing this from scratch, you still need the first download. This download contains a new backup script ONLY, that would be copied to the folder containing the original one and all the supporting files and directory structure.

( To run this, you'd run "backup2" instead of "backupessential" after copying it there )

I also added my personal "PREFERRED" set, it's a lot shorter than the Frater generic one included in the first post, and has a few things I added myself.

NOTE - Finding the DD-WRT BUILD to add to the file name was not an easy thing. I got it by finding a 5 digit number in the the login prompt in /tmp/

DDVer=`egrep -o '[0-9]{5}*' /tmp/loginprompt`

That should be safe for the next 75,000 builds are so, lol

If someone has a better way, please suggest it Smile


*********** *********** *********** *********** *********** *********** ***********
UPDATE: Do NOT download this, new busybox doesn't have egrep, see post 1 for latest version
*********** *********** *********** *********** *********** *********** ***********



r7000-Backup2.rar
 Description:
update

Download
 Filename:  r7000-Backup2.rar
 Filesize:  1.87 KB
 Downloaded:  999 Time(s)



Last edited by RjG on Wed May 17, 2017 7:35; edited 1 time in total
NiTrus
DD-WRT User


Joined: 25 Dec 2010
Posts: 295
Location: Twin Cities, MN

PostPosted: Sat Jul 26, 2014 0:37    Post subject: Reply with quote
*** Optional Automated-Backup ***

this will automate RjG's new script, and run from the /opt directory..just unzip this file to /opt...

from putty-make the script executable, type:
chmod +x /opt/Backup2/BkpScript/backup2

enter this in dd-wrt webif Administration:Management:Cron:Additional Cron Jobs:
0 4 * * * root /opt/Backup2/BkpScript/backup2
this runs the script at 4am everyday..adjust as needed..

0 4 * * 0 root /opt/Backup2/BkpScript/backup2
this runs the script once a week at 4am on Sunday..adjust as needed..

[option to keep only latest files]
0 4 * * * root rm -f /opt/Backup2/backups/*
1 4 * * * root /opt/Backup2/BkpScript/backup2

this deletes all files and then runs backup2 at 4am everyday..adjust as needed..

backups stored in: /opt/Backup2/backups



Backup2.zip
 Description:

Download
 Filename:  Backup2.zip
 Filesize:  15.22 KB
 Downloaded:  829 Time(s)


_________________
NETGEAR R9000 | RT | 40134
NETGEAR R7800 | AP | 40134



Last edited by NiTrus on Sat Aug 02, 2014 21:58; edited 3 times in total
slidermike
DD-WRT Guru


Joined: 11 Nov 2013
Posts: 1487
Location: USA

PostPosted: Sat Jul 26, 2014 0:58    Post subject: Reply with quote
Nitrus,
thank you for the command line syntax.

Thank you RjG for the tweaked script & directions.

I do have a question.
I have your original script & I tweaked the "preferred" to capture fields I use that yours wasnt getting.

If I put the new backup2 & preferred script in place, will the new scripts miss what I added to the original preferred script?

Mike

_________________
Router currently owned:
Netgear R7800 - Router
Netgear R7000 - AP mode

R7000 specific Tips/Tricks.
http://www.dd-wrt.com/phpBB2/viewtopic.php?t=264152
poser
DD-WRT User


Joined: 03 Jan 2009
Posts: 68

PostPosted: Tue Jul 29, 2014 5:14    Post subject: Reply with quote
Very nice work. Thanks Nitrus / RjG

and Slidermike for his thread maintenance!

_________________
-----------------------------------
R7000
KONG 24710
Wolf_666
DD-WRT Novice


Joined: 02 Jul 2014
Posts: 20
Location: Italy

PostPosted: Tue Jul 29, 2014 8:53    Post subject: Reply with quote
Excellent and very useful job.
Thanks Nitrus / RjG

_________________
TV LC-40LE924E - Firewall/Router pfSense on A1SRi-2558 - AP R7000 (FW Stock 1.0.4.5) - NMT A-210 (evZap! Skin) - Switch ProCurve 1410-8G - NAS DS213+ (2 x ST3000DM001-1CH166-301 FW: CC24) - Laptop M17xR2
HalfBit
DD-WRT Guru


Joined: 04 Sep 2009
Posts: 776
Location: AR, USA

PostPosted: Tue Jul 29, 2014 13:57    Post subject: Reply with quote
Just installed and scheduled the script to run weekly at 4am. Thank you RjG and NiTrus!
_________________
R7000 Nighthawk - DD-WRT v3.0-r50308
R7000 Nighthawk - DD-WRT v3.0-r50308
~~~~~~~~~~Dismantled for learning opportunities~~~~~~~~~~
WRT54Gv2
WRT54Gv8.2
~~~~~~~~~~Other Settings~~~~~~~~~
https://nextdns.io/?from=2d3sq39x
https://pi-hole.net/
https://github.com/DNSCrypt/dnscrypt-proxy
chorton
DD-WRT Novice


Joined: 06 Jul 2006
Posts: 12

PostPosted: Wed Jul 30, 2014 5:39    Post subject: Reply with quote
I was looking for a way to quickly get my settings back. I have the r6300v2, which I think uses the same firmware, would there be any problem using this script on that router as well?

Thanks
Goto page 1, 2, 3, 4  Next Display posts from previous:    Page 1 of 4
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum