As stated before I only know enough about Linux to make me dangerous and did not write this script. Original credit goes to frater. Background: Router = Asus RT-N66U Firmware = Shibby 95 AIO build External Storage = 2GB MicroSD card in onboard slot. I am using the backup settings script by Austin Saint Aubin Also using the Tutorial by ray123 Make syslog go to a disk or another computer If your not worried about logging then the ray's script is not needed and the sleep line can be removed. Also, I think 60 might be a little extreme of a sleep time, I will play around with it later to see exactly what is needed. Working Code: filename: 75-factdefault.autorun (placed in root dir of sd card) Code: #!/bin/sh NAME=factdefault.sh CUR_DIR="/mnt/DRIVENAME" restflag="${CUR_DIR}/just_restored" wl0_ssid=`nvram get wl0_ssid` lan_ipaddr=`nvram get lan_ipaddr` if [ ! -f "${restflag}" ] && [ "${lan_ipaddr}" = '192.168.1.1' ] && [ "${wl0_ssid}" = 'Tomato24' ] ; then sleep 60 logger -s -t $NAME "Detected a firmware reset" lastbackup="`ls -1t /tmp/mnt/DRIVE/PATH/TO/lastbackup_*.sh | head -n1`" touch "${restflag}" if [ -z "${lastbackup}" ] ; then logger -s -t $NAME "Unable to find a backup, will restore some handpicked settings" nvram set "nvramvar=nvramsetting" nvram commit else logger -s -t $NAME "Restore settings using ${lastbackup}" ${lastbackup} fi logger -s -t $NAME "Reboot" reboot else rm -f "${restflag}" 2>/dev/null fi At this point, I know it works when external storage is enabled or you use shibby's 95 AIO or higher, which has USB and SD function enabled by default. <s>The problem I am having is no logging is recorded.</s> No longer a problem for reference here is fraters script untouch that works flawlessly in DD-WRT Code: #!/bin/sh NAME=factconfig NAME="$0" [ -h "${NAME}" ] && NAME="`readlink "${NAME}"`" CUR_DIR="`dirname "${NAME}"`" restflag="${CUR_DIR}/just_restored" wl_ssid=`nvram get wl_ssid` lan_ipaddr=`nvram get lan_ipaddr` if [ ! -f "${restflag}" ] && [ "${lan_ipaddr}" = '192.168.1.1' ] && [ "${wl_ssid}" = 'dd-wrt' ] ; then optlog $NAME "Detected a firmware reset" lastbackup="`ls -1t /opt/var/backups/*.essential.sh | head -n1`" touch "${restflag}" if [ -z "${lastbackup}" ] ; then optlog $NAME "Unable to find a backup, will restore some handpicked settings" nvram set "nvramvar=nvramsetting" nvram commit else optlog $NAME "Restore settings using ${lastbackup}" ${lastbackup} fi optlog $NAME "Reboot" reboot else rm -f "${restflag}" 2>/dev/null fi DS
Ok,I have been through the logger man page, nothing helps. Am i asking such a stupid question that I should know the answer and am just overlooking it?
No the default is for the syslog to be on the ram disk with limited number of small files. You can get the router to broadcast to a remote logger by web gui, or there are ways to move the file to usb disk, see for example http://tomatousb.org/tut:make-syslog-go-to-a-disk-or-another-computer
Did the tutorial, Now i was seeing that it created a separate log file for 1970-01-01-0100 but wasn't being populated. So i placed a "sleep 60" in the script and began moving it around until it gave enough time to log. will update first post.