Backup settings and restore them to even different hardware.

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Goto page Previous  1, 2, 3 ... 8, 9, 10 ... 22, 23, 24  Next
Author Message
hardwarewizard
DD-WRT User


Joined: 15 Apr 2007
Posts: 200
Location: Buffalo, NY

PostPosted: Fri Jul 24, 2009 2:12    Post subject: Reply with quote
Code:
#!/bin/sh
#########################################################
# setup variables
#########################################################

DATE=`date +%m%d%Y`
MAC=`nvram get lan_hwaddr | tr -d ":"`
FILE=${MAC}.${DATE}
CUR_DIR=`dirname $0`

FOLDER=/opt/var/backups
VARFILE=/opt/tmp/all_vars
TO_ALL=${FOLDER}/${MAC}.${DATE}.all.sh
TO_INCLUDE=${FOLDER}/${MAC}.${DATE}.essential.sh
TO_EXCLUDE=${FOLDER}/${MAC}.${DATE}.dangerous.sh
TO_PREFERRED=${FOLDER}/${MAC}.${DATE}.preferred.sh

#########################################################
#FTP Login information change to your info
#########################################################
 
FTPS=ftp://192.168.1.100/backups
USERPASS=user:pass

#########################################################
#create NVRAM variale list and write to /opt/tmp/all_vars
#########################################################

nvram show 2>/dev/null | egrep '^[A-Za-z][A-Za-z0-9_\.\-]*=' | awk -F = '{print $1}' | sort -u >${VARFILE}

#########################################################
# Write header to restore scripts
#########################################################

echo -e "#!/bin/sh\n#\necho \"Write variables\"\n" | tee -i ${TO_EXCLUDE} | tee -i ${TO_PREFERRED} | tee -i  ${TO_ALL} > ${TO_INCLUDE}
 
#########################################################
# scan NVRAM variable list and send variable to proper
# restore script
#########################################################

cat ${VARFILE} | while read var
do
  pref=0
  if echo "${var}" | grep -q -f "${CUR_DIR}/vars_to_skip" ; then
    bfile=$TO_EXCLUDE
  else
    bfile=$TO_INCLUDE
    pref=`echo "${var}" | grep -cf "${CUR_DIR}/vars_preferred"`
  fi

  # get the data out of the variable
  data=`nvram get ${var}`
  # write the var to the file and use \ for special chars: (\$`")
  echo -en "nvram set ${var}=\"" | tee -ia ${TO_ALL} >> ${bfile}
  echo -n "${data}" |  sed -e 's/[$`"\]/\\&/g' | tee -ia  ${TO_ALL} >> ${bfile}
  echo -e "\"" | tee -ia  ${TO_ALL} >> ${bfile}
  if [ ! ${pref} == 0 ]; then
    echo -en "nvram set ${var}=\"" >> ${TO_PREFERRED}
    echo -n "${data}" |  sed -e 's/[$`"\]/\\&/g' >> ${TO_PREFERRED}
    echo -e "\"" >> ${TO_PREFERRED}
  fi
done

#########################################################
# cleanup remove /opt/tmp/all_vars
#########################################################

# rm ${VARFILE}

#########################################################
# Write footer to restore script
#########################################################

echo -e "\n# Commit variables\necho \"Save variables to nvram\"\nnvram commit"  | tee -ia  ${TO_ALL} | tee -ia  ${TO_PREFERRED} | tee -ia  ${TO_EXCLUDE} >> ${TO_INCLUDE}

#########################################################
# Change permissions on restore scripts to make them
# executable
#########################################################

chmod +x ${TO_INCLUDE}
chmod +x ${TO_PREFERRED}
chmod +x ${TO_EXCLUDE}
chmod +x ${TO_ALL}

#########################################################
# Compress restore scripts and send them to ftp server
#########################################################

tar cpf - -C / "${TO_INCLUDE}" 2>/dev/null | gzip -c |  /opt/bin/curl -s -u ${USERPASS} "${FTPS}/${FILE}.essential.sh.tgz" -T -
tar cpf - -C / "${TO_PREFERRED}" 2>/dev/null | gzip -c |  /opt/bin/curl -s -u ${USERPASS} "${FTPS}/${FILE}.preferred.sh.tgz" -T -
tar cpf - -C / "${TO_EXCLUDE}" 2>/dev/null | gzip -c |  /opt/bin/curl -s -u ${USERPASS} "${FTPS}/${FILE}.dangerous.sh.tgz" -T -
tar cpf - -C / "${TO_ALL}" 2>/dev/null | gzip -c |  /opt/bin/curl -s -u ${USERPASS} "${FTPS}/${FILE}.all.sh.tgz" -T -


i added comments to what i believe to be a good working script check it out and let me know what should be added this way other people can understand the script better.


Last edited by hardwarewizard on Sun Jul 26, 2009 1:45; edited 1 time in total
Sponsor
rcblackwell
DD-WRT User


Joined: 18 Jun 2009
Posts: 84

PostPosted: Sat Jul 25, 2009 11:58    Post subject: Reply with quote
dellsweig wrote:
frater wrote:
Well, I agree...

You can do it if you want to. Wink


No problem - here is what I have done........


frater / dellsweig,

I just used your information to upgrade my Linksys WRT150N Router to build 12533. Even with a significant amount of double checking it took me less than an hour.

Thank you for your contribution in this regard.

Bob Blackwell
Pickering, On
DHC_DarkShadow
DD-WRT Guru


Joined: 22 Jun 2008
Posts: 2440
Location: Am now Dark_Shadow

PostPosted: Sat Jul 25, 2009 14:13    Post subject: Reply with quote
rcblackwell wrote:
dellsweig wrote:
frater wrote:
Well, I agree...

You can do it if you want to. Wink


No problem - here is what I have done........


frater / dellsweig,

I just used your information to upgrade my Linksys WRT150N Router to build 12533. Even with a significant amount of double checking it took me less than an hour.

Thank you for your contribution in this regard.

Bob Blackwell
Pickering, On


Yes, I know it's been said over and over again, but Thanks from the Shadow.

_________________
The New Me
hardwarewizard
DD-WRT User


Joined: 15 Apr 2007
Posts: 200
Location: Buffalo, NY

PostPosted: Sun Jul 26, 2009 0:54    Post subject: Reply with quote
crashfly wrote:
Yes. If you can figure this one out, we would be much appreciated.

Although I can imagine a way to possibly test it. Re-establish the variables (possibly after a hard reset), then change that particular option and rerun the backup program to see what (if anything has changed).



i believe i have figured it out the wl_ variables over write the wl0_ variables


http://svn.dd-wrt.com:8000/dd-wrt/ticket/1177
crashfly
DD-WRT Guru


Joined: 24 Feb 2009
Posts: 2026
Location: Sol System > Earth > USA > Arkansas

PostPosted: Sun Jul 26, 2009 2:03    Post subject: Reply with quote
I wonder if it would be possible to figure out a way to make the wl_variables get written to first, then write the wl0_variables in this script. I know it is not *that* complicated, but that might be something worth looking into.

Edit: I have looked at the 'results' of the script. It appears that wl0 is written first, then wl1 and finally wl variables. I will consider switching them around on my "next" test upgrade and see if this fixes the problem.

_________________
E3000 22200M KongVPN K26
WRT600n v1.1 refirb mega 18767 BS K24 NEWD2 [not used]
WRT54G v2 16214 BS K24 [access point]

Try Dropbox for syncing files - get 2.5gb online for free by signing up.

Read! Peacock thread
*PLEASE* upgrade PAST v24SP1 or no support.
frater
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 2777

PostPosted: Sun Jul 26, 2009 8:48    Post subject: Reply with quote
It doesn't matter at all in which order these variables are written. Nothing is being done with these variables until the services that need them are restarted (so I'm convinced until you show me the contrary). You also need to reboot the router after writing.

The reason why I sort them (alphabetically) is that I can do a diff and see what variables have been changed.

I know that using this script is not without any issues but I'm convinced the reason is DD-WRT itself.

After I factory-default my router and restore the settings with my script I always have to turn off WDS and turn it on afterwards to get it going. I have no physical access to my WAN-router, so this is cumbersome process. I would like to make this an entry in TRAC but I'm sure the ticket will get closed leaving my script to blame.

I stopped investigating it and just change my WDS-bridge in a client-bridge and change these settings manually. I will investigate it another time the next time I will do an upgrade (using diff to compare the vars before and after getting WDS going.)

_________________
Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge

DD-WRT v24-sp2 vpn (c) 2010 NewMedia-NET GmbH
Release: 12/16/10 (SVN revision: 15758M)
frater
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 2777

PostPosted: Sun Jul 26, 2009 9:19    Post subject: Reply with quote
I just saw the entry you made in TRAC.
It seems the command "nvram set" is doing more than just set that particular variable...

Not the right place to keep those 2 variables in sync. It's probably been done as a quick and dirty fix after they started supporting multiple wireless interfaces.

The remark I made in my previous post is still valid, but it doesn't take this kind of programming into account. I hate it when commands do other things than they say. I used to have the sources on my linux system but that didn't survive a harddisk crash.

I will now look into an elegant way to write the wl_ variables first. A quick-and-dirty way would be to use sort -r -u instead of sort -u.

_________________
Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge

DD-WRT v24-sp2 vpn (c) 2010 NewMedia-NET GmbH
Release: 12/16/10 (SVN revision: 15758M)
frater
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 2777

PostPosted: Sun Jul 26, 2009 10:18    Post subject: Reply with quote
Thanks hardwarewizard for adding the comments, finding the "feature" in DD-WRT and adding PREFERRED to that echo line (cosmetic).

Here's the script that should take care of the order in which the variables are written.

Code:
#!/bin/sh
#########################################################
# setup variables
#########################################################

DATE=`date +%m%d%Y`
MAC=`nvram get lan_hwaddr | tr -d ":"`
FILE=${MAC}.${DATE}
CUR_DIR=`dirname $0`

FOLDER=/opt/var/backups
VARFILE=/opt/tmp/all_vars
TO_ALL=${FOLDER}/${MAC}.${DATE}.all.sh
TO_INCLUDE=${FOLDER}/${MAC}.${DATE}.essential.sh
TO_EXCLUDE=${FOLDER}/${MAC}.${DATE}.dangerous.sh
TO_PREFERRED=${FOLDER}/${MAC}.${DATE}.preferred.sh

#########################################################
#FTP Login information change to your info
#########################################################
 
FTPS=ftp://192.168.1.100/backups
USERPASS=user:pass
 
#########################################################
#create NVRAM variale list and write to /opt/tmp/all_vars
#########################################################
 
nvram show 2>/dev/null | egrep '^[A-Za-z][A-Za-z0-9_\.\-]*=' | awk -F = '{print $1}' | sort -r -u >${VARFILE}
 
#########################################################
# Write header to restore scripts
#########################################################
 
echo -e "#!/bin/sh\n#\necho \"Write variables\"\n" | tee -i ${TO_EXCLUDE} | tee -i ${TO_PREFERRED} | tee -i  ${TO_ALL} > ${TO_INCLUDE}
 
#########################################################
# scan NVRAM variable list and send variable to proper
# restore script
#########################################################
 
cat ${VARFILE} | while read var
do
  pref=0
  if echo "${var}" | grep -q -f "${CUR_DIR}/vars_to_skip" ; then
    bfile=$TO_EXCLUDE
  else
    bfile=$TO_INCLUDE
    pref=`echo "${var}" | grep -cf "${CUR_DIR}/vars_preferred"`
  fi

  # get the data out of the variable
  data=`nvram get ${var}`
  # write the var to the file and use \ for special chars: (\$`")
  echo -en "nvram set ${var}=\"" | tee -ia ${TO_ALL} >> ${bfile}
  echo -n "${data}" |  sed -e 's/[$`"\]/\\&/g' | tee -ia  ${TO_ALL} >> ${bfile}
  echo -e "\"" | tee -ia  ${TO_ALL} >> ${bfile}
  if [ ! ${pref} == 0 ]; then
    echo -en "nvram set ${var}=\"" >> ${TO_PREFERRED}
    echo -n "${data}" |  sed -e 's/[$`"\]/\\&/g' >> ${TO_PREFERRED}
    echo -e "\"" >> ${TO_PREFERRED}
  fi
done
                                                 
#########################################################
# cleanup remove /opt/tmp/all_vars
#########################################################

# rm ${VARFILE}
                       
#########################################################
# Write footer to restore script
#########################################################
                                                 
echo -e "\n# Commit variables\necho \"Save variables to nvram\"\nnvram commit"  | tee -ia  ${TO_ALL} | tee -ia  ${TO_PREFERRED} | tee -ia  ${TO_EXCLUDE} >> ${TO_INCLUDE}

#########################################################
# Change permissions on restore scripts to make them
# executable
#########################################################
                 
chmod +x ${TO_INCLUDE}
chmod +x ${TO_PREFERRED}
chmod +x ${TO_EXCLUDE}
chmod +x ${TO_ALL}
                     
#########################################################
# Compress restore scripts and send them to ftp server
#########################################################

tar cpf - -C / "${TO_INCLUDE}" 2>/dev/null | gzip -c |  /opt/bin/curl -s -u ${USERPASS} "${FTPS}/${FILE}.essential.sh.tgz" -T -
tar cpf - -C / "${TO_PREFERRED}" 2>/dev/null | gzip -c |  /opt/bin/curl -s -u ${USERPASS} "${FTPS}/${FILE}.preferred.sh.tgz" -T -
tar cpf - -C / "${TO_EXCLUDE}" 2>/dev/null | gzip -c |  /opt/bin/curl -s -u ${USERPASS} "${FTPS}/${FILE}.dangerous.sh.tgz" -T -
tar cpf - -C / "${TO_ALL}" 2>/dev/null | gzip -c |  /opt/bin/curl -s -u ${USERPASS} "${FTPS}/${FILE}.all.sh.tgz" -T -

_________________
Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge

DD-WRT v24-sp2 vpn (c) 2010 NewMedia-NET GmbH
Release: 12/16/10 (SVN revision: 15758M)
dellsweig
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 1476
Location: New York, USA

PostPosted: Sun Jul 26, 2009 13:34    Post subject: Reply with quote
frater wrote:
Thanks hardwarewizard for adding the comments, finding the "feature" in DD-WRT and adding PREFERRED to that echo line (cosmetic).

Here's the script that should take care of the order in which the variables are written.

Code:
#!/bin/sh
#########################################################
# setup variables
#########################################################

DATE=`date +%m%d%Y`
MAC=`nvram get lan_hwaddr | tr -d ":"`
FILE=${MAC}.${DATE}
CUR_DIR=`dirname $0`

FOLDER=/opt/var/backups
VARFILE=/opt/tmp/all_vars
TO_ALL=${FOLDER}/${MAC}.${DATE}.all.sh
TO_INCLUDE=${FOLDER}/${MAC}.${DATE}.essential.sh
TO_EXCLUDE=${FOLDER}/${MAC}.${DATE}.dangerous.sh
TO_PREFERRED=${FOLDER}/${MAC}.${DATE}.preferred.sh

#########################################################
#FTP Login information change to your info
#########################################################
 
FTPS=ftp://192.168.1.100/backups
USERPASS=user:pass
 
#########################################################
#create NVRAM variale list and write to /opt/tmp/all_vars
#########################################################
 
nvram show 2>/dev/null | egrep '^[A-Za-z][A-Za-z0-9_\.\-]*=' | awk -F = '{print $1}' | sort -r -u >${VARFILE}
 
#########################################################
# Write header to restore scripts
#########################################################
 
echo -e "#!/bin/sh\n#\necho \"Write variables\"\n" | tee -i ${TO_EXCLUDE} | tee -i ${TO_PREFERRED} | tee -i  ${TO_ALL} > ${TO_INCLUDE}
 
#########################################################
# scan NVRAM variable list and send variable to proper
# restore script
#########################################################
 
cat ${VARFILE} | while read var
do
  pref=0
  if echo "${var}" | grep -q -f "${CUR_DIR}/vars_to_skip" ; then
    bfile=$TO_EXCLUDE
  else
    bfile=$TO_INCLUDE
    pref=`echo "${var}" | grep -cf "${CUR_DIR}/vars_preferred"`
  fi

  # get the data out of the variable
  data=`nvram get ${var}`
  # write the var to the file and use \ for special chars: (\$`")
  echo -en "nvram set ${var}=\"" | tee -ia ${TO_ALL} >> ${bfile}
  echo -n "${data}" |  sed -e 's/[$`"\]/\\&/g' | tee -ia  ${TO_ALL} >> ${bfile}
  echo -e "\"" | tee -ia  ${TO_ALL} >> ${bfile}
  if [ ! ${pref} == 0 ]; then
    echo -en "nvram set ${var}=\"" >> ${TO_PREFERRED}
    echo -n "${data}" |  sed -e 's/[$`"\]/\\&/g' >> ${TO_PREFERRED}
    echo -e "\"" >> ${TO_PREFERRED}
  fi
done
                                                 
#########################################################
# cleanup remove /opt/tmp/all_vars
#########################################################

# rm ${VARFILE}
                       
#########################################################
# Write footer to restore script
#########################################################
                                                 
echo -e "\n# Commit variables\necho \"Save variables to nvram\"\nnvram commit"  | tee -ia  ${TO_ALL} | tee -ia  ${TO_PREFERRED} | tee -ia  ${TO_EXCLUDE} >> ${TO_INCLUDE}

#########################################################
# Change permissions on restore scripts to make them
# executable
#########################################################
                 
chmod +x ${TO_INCLUDE}
chmod +x ${TO_PREFERRED}
chmod +x ${TO_EXCLUDE}
chmod +x ${TO_ALL}
                     
#########################################################
# Compress restore scripts and send them to ftp server
#########################################################

tar cpf - -C / "${TO_INCLUDE}" 2>/dev/null | gzip -c |  /opt/bin/curl -s -u ${USERPASS} "${FTPS}/${FILE}.essential.sh.tgz" -T -
tar cpf - -C / "${TO_PREFERRED}" 2>/dev/null | gzip -c |  /opt/bin/curl -s -u ${USERPASS} "${FTPS}/${FILE}.preferred.sh.tgz" -T -
tar cpf - -C / "${TO_EXCLUDE}" 2>/dev/null | gzip -c |  /opt/bin/curl -s -u ${USERPASS} "${FTPS}/${FILE}.dangerous.sh.tgz" -T -
tar cpf - -C / "${TO_ALL}" 2>/dev/null | gzip -c |  /opt/bin/curl -s -u ${USERPASS} "${FTPS}/${FILE}.all.sh.tgz" -T -


Frater

You might want to add a command line switch to enable/disable the last section (tar and ftp).

many of us have either a samba share or usb filesystem where we dont need to ftp. On the boxes that dont, I prefer to use winscp and manually move the restore files to a safe location.

Finally, you should check with Eko or one of the keepers of DD-WRT - maybe you can get this script added to the download section. This script has saved my rear more times than I can count.

Dan
hardwarewizard
DD-WRT User


Joined: 15 Apr 2007
Posts: 200
Location: Buffalo, NY

PostPosted: Sun Jul 26, 2009 13:37    Post subject: Reply with quote
no problem adding comments what i did was just an initial stab at it i am workng on more detailed explainations.

funny you should mention a comand line switch to turn on/off the ftp i was thinking about that last night. Smile


Last edited by hardwarewizard on Sun Jul 26, 2009 14:48; edited 1 time in total
frater
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 2777

PostPosted: Sun Jul 26, 2009 13:46    Post subject: Reply with quote
dellsweig wrote:
You might want to add a command line switch to enable/disable the last section (tar and ftp).

many of us have either a samba share or usb filesystem where we dont need to ftp. On the boxes that dont, I prefer to use winscp and manually move the restore files to a safe location.

Nothing's easier than leaving that last bit off when you add it to your router....
dellsweig wrote:
Finally, you should check with Eko or one of the keepers of DD-WRT - maybe you can get this script added to the download section. This script has saved my rear more times than I can count.

I can't get in touch with Brainslayer nor Eko. When I write them I get no response at all, anymore. I'd like to get my reverse-proxy added to the firmware, Large File Support for busybox and a standard startup-script for /opt/etc/init.d (I now have to use valuable nvram to accomplish that). That's my priority list in a nutshell....

_________________
Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge

DD-WRT v24-sp2 vpn (c) 2010 NewMedia-NET GmbH
Release: 12/16/10 (SVN revision: 15758M)
frater
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 2777

PostPosted: Sun Jul 26, 2009 14:05    Post subject: Reply with quote
Quote:
You might want to add a command line switch to enable/disable the last section (tar and ftp).

Alright then....
Code:
#!/bin/sh
#########################################################
# setup variables
#########################################################

#########################################################
#FTP Login information change to your info
#########################################################
FTPS=ftp://192.168.10.210/backups
USERPASS=user:pass
transfer=0
while getopts tu:f: name
do
  case $name in
  t)   transfer=1;;
  u)   USERPASS="$OPTARG";;
  f)   FTPS="$OPTARG";;
  ?)   printf "Usage: %s: [-t] [-u username:password] [-f ftpserver]\n" $0
       exit 2;;
  esac
done
shift $(($OPTIND - 1))

DATE=`date +%m%d%Y`
MAC=`nvram get lan_hwaddr | tr -d ":"`
FILE=${MAC}.${DATE}
CUR_DIR=`dirname $0`

FOLDER=/opt/var/backups
VARFILE=/opt/tmp/all_vars
TO_ALL=${FOLDER}/${MAC}.${DATE}.all.sh
TO_INCLUDE=${FOLDER}/${MAC}.${DATE}.essential.sh
TO_EXCLUDE=${FOLDER}/${MAC}.${DATE}.dangerous.sh
TO_PREFERRED=${FOLDER}/${MAC}.${DATE}.preferred.sh


#########################################################
#create NVRAM variale list and write to /opt/tmp/all_vars
#########################################################

nvram show 2>/dev/null | egrep '^[A-Za-z][A-Za-z0-9_\.\-]*=' | awk -F = '{print $1}' | sort -r -u >${VARFILE}

#########################################################
# Write header to restore scripts
#########################################################

echo -e "#!/bin/sh\n#\necho \"Write variables\"\n" | tee -i ${TO_EXCLUDE} | tee -i ${TO_PREFERRED} | tee -i  ${TO_ALL} > ${TO_INCLUDE}

#########################################################
# scan NVRAM variable list and send variable to proper
# restore script
#########################################################

cat ${VARFILE} | while read var
do
  pref=0
  if echo "${var}" | grep -q -f "${CUR_DIR}/vars_to_skip" ; then
    bfile=$TO_EXCLUDE
  else
    bfile=$TO_INCLUDE
    pref=`echo "${var}" | grep -cf "${CUR_DIR}/vars_preferred"`
  fi

  # get the data out of the variable
  data=`nvram get ${var}`
  # write the var to the file and use \ for special chars: (\$`")
  echo -en "nvram set ${var}=\"" | tee -ia ${TO_ALL} >> ${bfile}
  echo -n "${data}" |  sed -e 's/[$`"\]/\\&/g' | tee -ia  ${TO_ALL} >> ${bfile}
  echo -e "\"" | tee -ia  ${TO_ALL} >> ${bfile}
  if [ ! ${pref} == 0 ]; then
    echo -en "nvram set ${var}=\"" >> ${TO_PREFERRED}
    echo -n "${data}" |  sed -e 's/[$`"\]/\\&/g' >> ${TO_PREFERRED}
    echo -e "\"" >> ${TO_PREFERRED}
  fi
done

#########################################################
# cleanup remove /opt/tmp/all_vars
#########################################################

# rm ${VARFILE}

#########################################################
# Write footer to restore script
#########################################################

echo -e "\n# Commit variables\necho \"Save variables to nvram\"\nnvram commit"  | tee -ia  ${TO_ALL} | tee -ia  ${TO_PREFERRED} | tee -ia  ${TO_EXCLUDE} >> ${TO_INCLUDE}

#########################################################
# Change permissions on restore scripts to make them
# executable
#########################################################

chmod +x ${TO_INCLUDE}
chmod +x ${TO_PREFERRED}
chmod +x ${TO_EXCLUDE}
chmod +x ${TO_ALL}

#########################################################
# Compress restore scripts and send them to ftp server
#########################################################

if [ ${transfer} -ne 0 ] ; then
  tar cpf - -C / "${TO_INCLUDE}" 2>/dev/null | gzip -c |  /opt/bin/curl -s -u ${USERPASS} "${FTPS}/${FILE}.essential.sh.tgz" -T -
  tar cpf - -C / "${TO_PREFERRED}" 2>/dev/null | gzip -c |  /opt/bin/curl -s -u ${USERPASS} "${FTPS}/${FILE}.preferred.sh.tgz" -T -
  tar cpf - -C / "${TO_EXCLUDE}" 2>/dev/null | gzip -c |  /opt/bin/curl -s -u ${USERPASS} "${FTPS}/${FILE}.dangerous.sh.tgz" -T -
  tar cpf - -C / "${TO_ALL}" 2>/dev/null | gzip -c |  /opt/bin/curl -s -u ${USERPASS} "${FTPS}/${FILE}.all.sh.tgz" -T -
fi

_________________
Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge

DD-WRT v24-sp2 vpn (c) 2010 NewMedia-NET GmbH
Release: 12/16/10 (SVN revision: 15758M)


Last edited by frater on Sun Jul 26, 2009 14:44; edited 1 time in total
Eko
DD-WRT Developer/Maintainer


Joined: 07 Jun 2006
Posts: 5771

PostPosted: Sun Jul 26, 2009 14:16    Post subject: Reply with quote
frater wrote:

I can't get in touch with Brainslayer nor Eko. When I write them I get no response at all, anymore. I'd like to get my reverse-proxy added to the firmware, Large File Support for busybox and a standard startup-script for /opt/etc/init.d (I now have to use valuable nvram to accomplish that). That's my priority list in a nutshell....

I didn't forget it... just no time to do it and it's summer.....
frater
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 2777

PostPosted: Sun Jul 26, 2009 14:29    Post subject: Reply with quote
Eko wrote:
I didn't forget it... just no time to do it and it's summer.....

Okay....
Well... "No" or "Not yet" is a reply too as I always say...

_________________
Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge

DD-WRT v24-sp2 vpn (c) 2010 NewMedia-NET GmbH
Release: 12/16/10 (SVN revision: 15758M)
DHC_DarkShadow
DD-WRT Guru


Joined: 22 Jun 2008
Posts: 2440
Location: Am now Dark_Shadow

PostPosted: Sun Jul 26, 2009 17:02    Post subject: Reply with quote
At the very least shouldn't this be added to the Wiki under useful scripts?
_________________
The New Me
Goto page Previous  1, 2, 3 ... 8, 9, 10 ... 22, 23, 24  Next Display posts from previous:    Page 9 of 24
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