yes, but it does not say you need to run ALL 3 .sh files, and that is what I'm trying to clear up...the instructions says to run only one of them by name to preform a restore. So all 3 must be run to do a full retore ? _________________ 1 WRT160N v3 - remote AP WPA2 Personal Aes dd-wrt-mini-trailed CPU OC400,
2 wrt54G v3(BCM4712 chip rev 1, corerev=7)- AP WPA2 Personal Aes dd-wrt-mini-generic CPU OC228,
1 wrt54gs v6 - remote AP WPA2 Personal Aes dd-wrt-micro CPU OC228 ,
3 WAP54g v3 - repeater, client Bridge, repeater bridge dd-wrt-micro CPU OC225,
1 NetGear WNR2000 v3 AP Atheros AR7241 ver 1 rev 1.1 (0x0101) Trailed build CPU OC360
DD-WRT usually the most current BS builds and less frequently lately EKO builds(because of new BS rules that eliminated EKO builds I used).
You can run the essential, which should be enough.
The rest is for completeness and debugging purposes... _________________ 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
thanks frater... _________________ 1 WRT160N v3 - remote AP WPA2 Personal Aes dd-wrt-mini-trailed CPU OC400,
2 wrt54G v3(BCM4712 chip rev 1, corerev=7)- AP WPA2 Personal Aes dd-wrt-mini-generic CPU OC228,
1 wrt54gs v6 - remote AP WPA2 Personal Aes dd-wrt-micro CPU OC228 ,
3 WAP54g v3 - repeater, client Bridge, repeater bridge dd-wrt-micro CPU OC225,
1 NetGear WNR2000 v3 AP Atheros AR7241 ver 1 rev 1.1 (0x0101) Trailed build CPU OC360
DD-WRT usually the most current BS builds and less frequently lately EKO builds(because of new BS rules that eliminated EKO builds I used).
Just wanted to say thank you to both frater and dellsweig - I used to spend a ton of time saving PDF's of all my settings and redoing everything manually - now I can actually try out different builds without spending an hour or two each time with my settings.
When I run this script, everything ends up in both the all.sh script and the dangerous script, but my essential.sh file has nothing relevant in it.
It looks to me that this line is the problem:
Code:
f echo ${var} | grep -q -f "${CUR_DIR}/vars_to_skip" ; then
Doesn't the -q parameter cause nothing to be output? Or is grep supposed to send a return code back to the shell?
When I run this manually, it works fine (ie: it looks like my vars_to_skip file is being found and has the right eol delimiter).
Joined: 03 Apr 2008 Posts: 15 Location: Oshkosh, WI
Posted: Fri Apr 03, 2009 20:11 Post subject:
tcharron wrote:
When I run this script, everything ends up in both the all.sh script and the dangerous script, but my essential.sh file has nothing relevant in it.
It looks to me that this line is the problem:
Code:
f echo ${var} | grep -q -f "${CUR_DIR}/vars_to_skip" ; then
Doesn't the -q parameter cause nothing to be output? Or is grep supposed to send a return code back to the shell?
When I run this manually, it works fine (ie: it looks like my vars_to_skip file is being found and has the right eol delimiter).
i'm seeing the same problem. i'll play around with it and see if i can fix it. my bash scripting skills are a bit rusty though :D
EDIT:
found the problem. change that line to:
Code:
if cat ${CUR_DIR}/vars_to_skip | grep -q ${var} ; then
not sure why the original line doesn't work but that change worked for me. grep seems to have some different options than i'm used to (ubuntu). also it helps to put a # in front of the !/bin/sh
EDIT: bad advice... ignore this post! _________________ WRT54GL 1.1 V24-preSP2 VPN
WAPBR-100 V24-preSP2 micro
Last edited by smurphster on Tue Apr 07, 2009 1:08; edited 1 time in total
if cat ${CUR_DIR}/vars_to_skip | grep -q ${var} ; then
not sure why the original line doesn't work but that change worked for me. grep seems to have some different options than i'm used to (ubuntu). also it helps to put a # in front of the !/bin/sh
That # is only missing from Dellsweigs 'copy'.
I can't explain why that one line was nog working for you...
The change you did is doing the same as was intended. I don't know why the original wasn't working for you.
EDIT: The above is not true.. It seems to be the same, but it isn't. See my post below!!!!! _________________ 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
Actually, with the suggested change, it seems that all of the variables marked ^ are excluded, and those variables end up in the essential.sh script as a result.
I manually edited them out, but found that after running essential, some settings that should have been excluded were not. I tried migrating settings from a wrtsl54gs to a dell truemobile 2300, and dd-wrt identified itself as a wrtsl54gs (before rebooting). After rebooting, it was bricked.
When I run this script, everything ends up in both the all.sh script and the dangerous script, but my essential.sh file has nothing relevant in it.
It looks to me that this line is the problem:
Code:
f echo ${var} | grep -q -f "${CUR_DIR}/vars_to_skip" ; then
Doesn't the -q parameter cause nothing to be output? Or is grep supposed to send a return code back to the shell?
When I run this manually, it works fine (ie: it looks like my vars_to_skip file is being found and has the right eol delimiter).
i'm seeing the same problem. i'll play around with it and see if i can fix it. my bash scripting skills are a bit rusty though :D
EDIT:
found the problem. change that line to:
Code:
if cat ${CUR_DIR}/vars_to_skip | grep -q ${var} ; then
not sure why the original line doesn't work but that change worked for me. grep seems to have some different options than i'm used to (ubuntu). also it helps to put a # in front of the !/bin/sh
When I run this script: .all.sh and .essential.sh have the exact same contents in them, and dangerous.sh has nothing relevant in it. It seems odd to have the same script produce the same error in different output files to me. are we sure the script is outputting the correct variables in the restore scripts ?!?! _________________ 1 WRT160N v3 - remote AP WPA2 Personal Aes dd-wrt-mini-trailed CPU OC400,
2 wrt54G v3(BCM4712 chip rev 1, corerev=7)- AP WPA2 Personal Aes dd-wrt-mini-generic CPU OC228,
1 wrt54gs v6 - remote AP WPA2 Personal Aes dd-wrt-micro CPU OC228 ,
3 WAP54g v3 - repeater, client Bridge, repeater bridge dd-wrt-micro CPU OC225,
1 NetGear WNR2000 v3 AP Atheros AR7241 ver 1 rev 1.1 (0x0101) Trailed build CPU OC360
DD-WRT usually the most current BS builds and less frequently lately EKO builds(because of new BS rules that eliminated EKO builds I used).
if echo ${var} | grep -q -f "${CUR_DIR}/vars_to_skip" ; then
Because the contents of the file is used as an argument and then the ^ has a meaning as a valid expression (^ means the string has to start with...)
At first glance your line seemed to make sense, but it isn't doing what I intended at the time. Because I wrote the script a while ago I too thought it was the same.
I still don't know why the script isn't working for you. Mine gives me a config-file every night:
This is the script which runs every night on my router...
cat /opt/usr/sbin/backupessential
Code:
#!/bin/sh
#
# This shell script creates a shell file with lines of the form
# nvram set x=y
# for every nvram variable found from
# nvram show
#
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
FTPS=ftp://192.168.10.210/backups
USERPASS=user:password
#
echo -e "#!/bin/sh\n#\necho \"Write variables\"\n" | tee -i ${TO_EXCLUDE} | tee -i ${TO_ALL} > ${TO_INCLUDE}
cat ${VARFILE} | while read var
do
if echo ${var} | grep -q -f "${CUR_DIR}/vars_to_skip" ; then
bfile=$TO_EXCLUDE
else
bfile=$TO_INCLUDE
fi
# get the data out of the variable
data=`nvram get ${var}`
if [ "${data}" == "" ] ; then
echo -e "nvram set ${var}=" | tee -ia ${TO_ALL} >> ${bfile}
else
# 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 's/\\/\\\\/g' | sed 's/`/\\`/g' | sed 's/\$/\\\$/g' | sed 's/\"/\\"/g' | tee -ia ${TO_ALL} >> ${bfile}
echo -e "\"" | tee -ia ${TO_ALL} >> ${bfile}
fi
done
# rm ${VARFILE}
echo -e "\n# Commit variables\necho \"Save variables to nvram\"\nnvram commit" | tee -ia ${TO_ALL} | tee -ia ${TO_EXCLUDE} >> ${TO_INCLUDE}
chmod +x ${TO_ALL}
chmod +x ${TO_INCLUDE}
chmod +x ${TO_EXCLUDE}
_________________ 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
I think that when I cut and paste the vars_to_skip file into my editor from the dd-wrt site, it picked up trailing spaces on each line. Once I deleted them, it worked ok.
Joined: 03 Apr 2008 Posts: 15 Location: Oshkosh, WI
Posted: Mon Apr 06, 2009 21:07 Post subject:
frater: thanks for following up. i had a feeling you used that syntax to avoid some glitch. piping the file to grep just seemed too easy . i'll keep messing with it and see what i find.
one other thing i noticed though is...
Code:
CUR_DIR=`dirname $0`
returns "."
obviously the current directory is ".", it always is! but assuming the script is actually executing in /tmp, that should be fine. that may only be an issue in dellsweig's script. i'll take a look tonight. _________________ WRT54GL 1.1 V24-preSP2 VPN
WAPBR-100 V24-preSP2 micro