What's new

Permanently moving traffic.db and syslog.log over to a USB Drive?

  • 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!

dandle

Regular Contributor
Hi all

First time post so please be gentle :)

I recently purchased an Asus RT-AC68U router and installed the Merlin firmware which has been quite brilliant.

I've been learning about the features and what not day by day.

I have a question regarding moving over traffic.db and syslog.log over to a connected USB Drive permanently. Is it possible? I've read that constant writes to the /JFFS partition counts towards the finite write cycles it has. Now, the write cycles may be a large number but I've noticed the sizes of these files growing. Currently the traffic.db sits at around 3.7 MB and syslog at 255KB. It's the traffic.db I'm more concerned about as it grows ever so larger on a daily basis.

It would be great to move these over permanently to a USB Drive and not have to worry about wearing out the flash. Please bear in mind, I'm mostly a novice when it comes to scripting and command lines etc. I know the basics and my way around using SSH such as changing directories, copying, etc. But anything with a lot of syntax and commands will have me lost so please bear with me :)

Much appreciated.
 
Ah I see. So at what point would it be a concern? Only because within a week, out of the 60MB of storage dedicated to JFFS already 3MB have been used. Later down the line if it starts approaching the 60MB mark what would I need to do?
 
I was referring to any potential "wearing out" rather than the size of traffic.db. I'd guess that there's a fixed limit to the size of that file (there is for syslog), but I don't know. Hopefully someone that uses that feature can inform us.
 
Bump.

Will appreciate any more input

There are many examples in the forum to move Syslog to USB.

However here is my attempt, together with an example of init-start showing how it is used..

syslog-move.sh

http://pastebin.com/embed_js/M0qUATyj

EDIT: As the file is now hosted on pastebin.com , it appears to use \' to escape the single ' character.
So when pasting code into /jffs/scripts/syslog-move.sh you should replace all \' with '
Code:
Can't post updated version 2 code in-line - blocked :rolleyes:

It allows creation of several archived versions and auto scanning of BOOT errors (or will scan any syslog archive)
i.e. may be called several times manually which is useful if you want to test say the start of a VPN client... and want a separate log containing the test period

e.g.
Code:
./syslog-move.sh

do your testing...which presumably writes logger messages to Syslog, then save this segment of the Syslog

./syslog-move.sh

The script creates two files

BOOT_Errors.txt

Code:
Scanning /tmp/mnt/RT-AC68U/Syslog/syslog.log-20170123-093701-BOOT
Jan 23 09:21:58 RT-AC68U user.warn (syslog-move.sh): 3272 Scan of '/tmp/mnt/RT-AC68U/Syslog/syslog.log-20170123-092147-BOOT' found 40 errors
Jan 23 09:27:29 RT-AC68U daemon.warn openvpn[3409]: ERROR: Linux route delete command failed: external program exited with error status: 2
Aug  1 01:00:15 kernel: External imprecise Data abort at addr=0x0, fsr=0x1c06 ignored.
Aug  1 01:00:30 dnsmasq[523]: failed to execute /jffs/scripts/DHCP_LeaseTracker.sh: No such file or directory
Aug  1 01:00:36 dnsmasq[523]: failed to execute /jffs/scripts/DHCP_LeaseTracker.sh: No such file or directory
Aug  1 01:00:36 dnsmasq[523]: failed to execute /jffs/scripts/DHCP_LeaseTracker.sh: No such file or directory
Aug  1 01:00:36 dnsmasq[523]: failed to execute /jffs/scripts/DHCP_LeaseTracker.sh: No such file or directory
Aug  1 01:00:36 dnsmasq[523]: failed to send packet: Network is unreachable
Aug  1 01:00:37 kernel: EXT2-fs (sda1): error: ext2_lookup: deleted inode referenced: 13
Aug  1 01:00:37 kernel: EXT2-fs (sda1): error: ext2_lookup: deleted inode referenced: 13
Aug  1 01:00:37 kernel: EXT2-fs (sda1): error: ext2_lookup: deleted inode referenced: 13
Aug  1 01:00:37 kernel: EXT2-fs (sda1): error: ext2_lookup: deleted inode referenced: 13
Aug  1 01:00:37 kernel: EXT2-fs (sda1): error: ext2_lookup: deleted inode referenced: 13
Aug  1 01:00:38 (VPN_IPSETSelect.sh): 1169 **ERROR missing VPN5 ipset! (type should be 'list:set/setlist')'
Aug  1 01:00:38 dnsmasq[523]: failed to execute /jffs/scripts/DHCP_LeaseTracker.sh: No such file or director
<snip>

and MyCustomACtions.txt
Code:
Jan 23 09:21:47 RT-AC68U user.warn (syslog-move.sh): 3272 Syslog moved to USB drive '/tmp/mnt/RT-AC68U/Syslog/syslog.log'
Jan 23 09:21:52 RT-AC68U user.warn (syslog-move.sh): 3272 SYSLOG Housekeeping Complete...... Mon Jan 23 09:21:52 GMT 2017 for '/tmp/mnt/RT-AC68U/Syslog/syslog.log-20170123-092147'
Jan 23 09:21:58 RT-AC68U user.warn (syslog-move.sh): 3272 SYSLOG Housekeeping scanning: /tmp/mnt/RT-AC68U/Syslog/syslog.log-20170123-092147-BOOT
Jan 23 09:21:58 RT-AC68U user.warn (syslog-move.sh): 3272 Scan of '/tmp/mnt/RT-AC68U/Syslog/syslog.log-20170123-092147-BOOT' found 40 errors
Jan 23 09:21:58 RT-AC68U user.warn (syslog-move.sh): 3272 SYSLOG Housekeeping custom script action scanning: '/tmp/mnt/RT-AC68U/Syslog/MyCustomActions.txt'
Jan 23 09:21:58 RT-AC68U user.warn (init-start): 357 Martineau RT-AC68U BOOT Completed Firmware build 380.65 beta2 []
Jan 23 09:23:18 RT-AC68U user.warn (wan-start): 1008 wan-start UNLOCKED
Jan 23 09:25:53 RT-AC68U user.warn (vpnclient1-up): 3526 User Processing 'up' (tun11) via 10.200.197.165 args = [tun11 1500 1559 10.200.197.165 255.255.255.0 init]
Jan 23 09:25:53 RT-AC68U user.warn (vpnclient1-up): 3526 Added cru #GetVPN1_WANIP# every hh:01
Jan 23 09:25:53 RT-AC68U user.warn (vpnclient1-up): 3526 User Processing Complete.
Jan 23 09:25:56 RT-AC68U user.warn (vpnrouting.sh): 3563 v380.65 Patched by Martineau vpnrouting.sh
Jan 23 09:25:57 RT-AC68U user.warn (vpnclient1-route-up): 3740 User Processing 'route-up' (tun11) via 10.200.197.165 args=[tun11 1500 1559 10.200.197.165]
Jan 23 09:25:57 RT-AC68U user.warn (vpnclient1-route-up): 3740 Adding Selective routing RPDB fwmark 0x1000 via VPN Client 1 (NewYork)
Jan 23 09:25:57 RT-AC68U user.warn (vpnclient1-route-up): 3740 Added VPN subnet 10.200.197.0/24 dev tun11 scope link table NewYork
Jan 23 09:25:57 RT-AC68U user.warn (vpnclient1-route-up): 3740 CMD: ip route add /24 dev tun21 table NewYork
Jan 23 09:25:57 RT-AC68U user.warn (vpnclient1-route-up): 3740 User Processing Complete.
Jan 23 09:27:28 RT-AC68U user.warn (vpnrouting.sh): 3821 v380.65 Patched by Martineau vpnrouting.sh tun11 1500 1559 10.200.197.165 255.255.255.
<snip>

As you can see I am testing the new 380.65Beta firmware so there are a lot of reboots.

2017-01-23_20-09-22.png


Too much? :p

EDIT: Version2 of syslog-move.sh script can't be loaded inline:confused:
 
Last edited:
I think I may have done some more unnecessary writing to the jffs partition. So while researching this subject trying to see if there was a workaround, I came across a command posted by someone on this forum but it was for the syslog.log file.

rm syslog.log; mkdir syslog.log

I put that in and the file size shrunk to 0. So I thought perhaps I can do that for traffic.db too. Sure enough it shrunk to 0 too however my traffic statistics were gone. Luckily I had a backup of the traffic.db so I copied it back over to the jffs partition. That's an extra 1.3 MB of unnecessary writes it did to the partition in seconds. So while trying to find a workaround to save on writes I ended up using more writes. I've shortened the flash' lifespan haven't I?
 
There are many examples in the forum to move Syslog to USB.

However here is my attempt, together with an example of init-start showing how it is used..

syslog-move.sh
Code:
#!/bin/sh

# Called as the last line of init-start preferably after 180sec sleep delay!!!!
#
#    e.g. init-start
#
#        #!/bin/sh
#        /usr/bin/logger -s -t "($(basename $0))" $$ "Martineau $MYROUTER BOOT in progress... [$@]"
#        # NOTE: Can't use Flash drive /tmp/mnt/$MYROUTER/ 'cos it hasn't been mounted yet :-(
#        # 'flock' is probably a better solution rather than the 'echo' ;-)
#        echo $$"-"`date` > /tmp/BOOTINPROGRESS
#        # Should be sufficient to cover physical BOOT process?
#        logger -st "($(basename $0))" $$ "Paused for 3 mins....."
#        sleep 180
#        # call custom scripts/commands e.g. cifs.sh / cru etc. here...
#
#        # Move Syslog to USB Flash drive
#        /jffs/scripts/syslog-move.sh
#        rm /tmp/BOOTINPROGRESS
#        /usr/bin/logger -st "($(basename $0))" $$ "Martineau" $MYROUTER "BOOT Completed Firmware build" $BUILDNO $EXTENDNO "[$@]"
#        exit 0
#

logger -st "($(basename $0))" $$ SYSLOG Housekeeping Running...... `date` [$@]


MYROUTER=$(nvram get computer_name)

SOURCE="/tmp/syslog.log"                      # original source of the syslog on Router
SYSLOG="/tmp/mnt/$MYROUTER/Syslog/syslog.log" # destination of the syslog on USB disk
NASLOG="10.88.8.197"                          # Destination of Remote SYSLOG server NAS DS-416
ERRORFILE="/tmp/mnt/$MYROUTER/Syslog/BOOT_Errors.txt"
MYCUSTOMFILE="/tmp/mnt/$MYROUTER/Syslog/MyCustomActions.txt"
NOW=$(date +"%Y%m%d-%H%M%S")    # current date and time


if [ -z $1 ] || [ "$1" == "reset" ]; then
    mv $SYSLOG $SYSLOG-$NOW         # rename the previous log with timestamp
    # True REBOOT in progress? see init-start
    if [ -e /tmp/BOOTINPROGRESS  ]; then
        cp $SOURCE $SYSLOG-$NOW-BOOT    # copy current /tmp syslog to the new location
        logger -st "($(basename $0))" $$ "Creating '"$SYSLOG-$NOW-BOOT "' persistent BOOT log" $?
        SCANTHIS=$SYSLOG-$NOW-BOOT
    else
        cp $SOURCE $SYSLOG-$NOW-ZZ    # copy current /tmp syslog to the new location
        logger -st "($(basename $0))" $$ "Creating '"$SYSLOG-$NOW-ZZ "'persistent BOOT log" $?
        SCANTHIS=$SYSLOG-$NOW-ZZ
    fi
    rm $SOURCE                      # delete the /tmp syslog

    killall syslogd

    # Start SYSLOG on the USB disk with infinite size i.e. no GDG creation if no ARG supplied
    if [ ! "$1" == "reset" ];then
        syslogd -O $SYSLOG -s 0
        logger -st "($(basename $0))" $$ "Syslog moved to USB drive '"$SYSLOG"'"
    else
        syslogd -O $SOURCE    # put it back where ASUS expect its to be ? /tmp/syslog.log
        logger -st "($(basename $0))" $$ "Syslog reset to'"$SOURCE"'"   # display OK message
        exit 0
    fi

    if [ "$?" -ne 0 ]; then    # check for error
        logger -st "($(basename $0))" $$ SYSLOG Housekeeping errors $? ...... `date` for $SYSLOG-$NOW
        #exit $?
    else
        echo "Syslog move OK. Script: $0"    # display OK message
        #exit 0
    fi

    wait

    sleep 5

    logger -st "($(basename $0))" $$ SYSLOG Housekeeping Complete...... `date` for "'"$SYSLOG-$NOW"'"

    # Allow Router GUI to see the Syslog!!!!! otherwise it shows it empty!!!
    ln -s $SYSLOG $SOURCE           # create a symbolic link from the original syslog to the HDD one

    if [ "$?" -ne 0 ]; then
        logger -st "($(basename $0))" $$ "SYSLOG Housekeeping error rc=" $? "symbolic link error" $SYSLOG $SOURCE
    fi
 
    sleep 5
else
    SCANTHIS="/mnt/$MYROUTER/Syslog/$1"
fi


#if [ -e /tmp/BOOTINPROGRESS  ]; then
    # Scan the BOOT log for errors i.e. literal 'ERROR' or 'FAILED' or 'ABORT' case insensitive
    logger -st "($(basename $0))" $$ "SYSLOG Housekeeping scanning:" $SCANTHIS
    echo "Scanning $SCANTHIS" > $ERRORFILE
    ERROR_LINE_CNT=`grep -c -E -i "ERROR|FAILED|ABORT" $SCANTHIS`
    #logger -st "($(basename $0))" $$ "**DEBUG ERROR_LINE_CNT="$ERROR_LINE_CNT
    if [ "$ERROR_LINE_CNT" -gt 0 ]; then
        logger -st "($(basename $0))" $$ "Scan of '"$SCANTHIS"' found" $ERROR_LINE_CNT "errors"
        RC=`grep -E -i "ERROR|FAILED|ABORT" $SCANTHIS >> $ERRORFILE`
    else
        echo "Nothing ERROR or FAILED or ABORT found." >> $ERRORFILE
    fi
    # Scan the log for my custom script actions...
    logger -st "($(basename $0))" $$ "SYSLOG Housekeeping custom script action scanning: '"$MYCUSTOMFILE"'"
    CUSTOM_LINE_CNT=`grep -E -i "):" $SCANTHIS > $MYCUSTOMFILE`
#fi

exit 0

It allows creation of several archived versions and auto scanning of BOOT errors (or will scan any syslog archive)

The script creates two files

BOOT_Errors.txt

Code:
Scanning /tmp/mnt/RT-AC68U/Syslog/syslog.log-20170123-093701-BOOT
Jan 23 09:21:58 RT-AC68U user.warn (syslog-move.sh): 3272 Scan of '/tmp/mnt/RT-AC68U/Syslog/syslog.log-20170123-092147-BOOT' found 40 errors
Jan 23 09:27:29 RT-AC68U daemon.warn openvpn[3409]: ERROR: Linux route delete command failed: external program exited with error status: 2
Aug  1 01:00:15 kernel: External imprecise Data abort at addr=0x0, fsr=0x1c06 ignored.
Aug  1 01:00:30 dnsmasq[523]: failed to execute /jffs/scripts/DHCP_LeaseTracker.sh: No such file or directory
Aug  1 01:00:36 dnsmasq[523]: failed to execute /jffs/scripts/DHCP_LeaseTracker.sh: No such file or directory
Aug  1 01:00:36 dnsmasq[523]: failed to execute /jffs/scripts/DHCP_LeaseTracker.sh: No such file or directory
Aug  1 01:00:36 dnsmasq[523]: failed to execute /jffs/scripts/DHCP_LeaseTracker.sh: No such file or directory
Aug  1 01:00:36 dnsmasq[523]: failed to send packet: Network is unreachable
Aug  1 01:00:37 kernel: EXT2-fs (sda1): error: ext2_lookup: deleted inode referenced: 13
Aug  1 01:00:37 kernel: EXT2-fs (sda1): error: ext2_lookup: deleted inode referenced: 13
Aug  1 01:00:37 kernel: EXT2-fs (sda1): error: ext2_lookup: deleted inode referenced: 13
Aug  1 01:00:37 kernel: EXT2-fs (sda1): error: ext2_lookup: deleted inode referenced: 13
Aug  1 01:00:37 kernel: EXT2-fs (sda1): error: ext2_lookup: deleted inode referenced: 13
Aug  1 01:00:38 (VPN_IPSETSelect.sh): 1169 **ERROR missing VPN5 ipset! (type should be 'list:set/setlist')'
Aug  1 01:00:38 dnsmasq[523]: failed to execute /jffs/scripts/DHCP_LeaseTracker.sh: No such file or director
<snip>

and MyCustomACtions.txt
Code:
Jan 23 09:21:47 RT-AC68U user.warn (syslog-move.sh): 3272 Syslog moved to USB drive '/tmp/mnt/RT-AC68U/Syslog/syslog.log'
Jan 23 09:21:52 RT-AC68U user.warn (syslog-move.sh): 3272 SYSLOG Housekeeping Complete...... Mon Jan 23 09:21:52 GMT 2017 for '/tmp/mnt/RT-AC68U/Syslog/syslog.log-20170123-092147'
Jan 23 09:21:58 RT-AC68U user.warn (syslog-move.sh): 3272 SYSLOG Housekeeping scanning: /tmp/mnt/RT-AC68U/Syslog/syslog.log-20170123-092147-BOOT
Jan 23 09:21:58 RT-AC68U user.warn (syslog-move.sh): 3272 Scan of '/tmp/mnt/RT-AC68U/Syslog/syslog.log-20170123-092147-BOOT' found 40 errors
Jan 23 09:21:58 RT-AC68U user.warn (syslog-move.sh): 3272 SYSLOG Housekeeping custom script action scanning: '/tmp/mnt/RT-AC68U/Syslog/MyCustomActions.txt'
Jan 23 09:21:58 RT-AC68U user.warn (init-start): 357 Martineau RT-AC68U BOOT Completed Firmware build 380.65 beta2 []
Jan 23 09:23:18 RT-AC68U user.warn (wan-start): 1008 wan-start UNLOCKED
Jan 23 09:25:53 RT-AC68U user.warn (vpnclient1-up): 3526 User Processing 'up' (tun11) via 10.200.197.165 args = [tun11 1500 1559 10.200.197.165 255.255.255.0 init]
Jan 23 09:25:53 RT-AC68U user.warn (vpnclient1-up): 3526 Added cru #GetVPN1_WANIP# every hh:01
Jan 23 09:25:53 RT-AC68U user.warn (vpnclient1-up): 3526 User Processing Complete.
Jan 23 09:25:56 RT-AC68U user.warn (vpnrouting.sh): 3563 v380.65 Patched by Martineau vpnrouting.sh
Jan 23 09:25:57 RT-AC68U user.warn (vpnclient1-route-up): 3740 User Processing 'route-up' (tun11) via 10.200.197.165 args=[tun11 1500 1559 10.200.197.165]
Jan 23 09:25:57 RT-AC68U user.warn (vpnclient1-route-up): 3740 Adding Selective routing RPDB fwmark 0x1000 via VPN Client 1 (NewYork)
Jan 23 09:25:57 RT-AC68U user.warn (vpnclient1-route-up): 3740 Added VPN subnet 10.200.197.0/24 dev tun11 scope link table NewYork
Jan 23 09:25:57 RT-AC68U user.warn (vpnclient1-route-up): 3740 CMD: ip route add /24 dev tun21 table NewYork
Jan 23 09:25:57 RT-AC68U user.warn (vpnclient1-route-up): 3740 User Processing Complete.
Jan 23 09:27:28 RT-AC68U user.warn (vpnrouting.sh): 3821 v380.65 Patched by Martineau vpnrouting.sh tun11 1500 1559 10.200.197.165 255.255.255.
<snip>

As you can see I am testing the new 380.65Beta firmware so there are a lot of reboots.

View attachment 8341

Too much? :p

Thanks for this. Much appreciated. Just wish I knew what it all meant and where/how to place it :p

Can this be applicable to the traffic.db too?
 
Can this be applicable to the traffic.db too?
No

Just wish I knew what it all meant and where/how to place it

Simply cut'n''paste contents to create two scripts
Code:
/jffs/scripts/syslog_move.sh
/jffs/scripts/init-start

If using windows, install and use WinSCP in SCP mode to connect to router to facilitate a drag'n' drop GUI to cut'n'paste the contents
or
SSH to router and issue commands to use nano editor for cut'n'paste
Code:
cd /jffs/scripts
nano syslog_move.sh
nano init-start

P.S. Make sure you changed the name of the 'sdx' device, as this is used to identify the actual mount point fot the Syslog folder on USB/HDD (see line 95)
Code:
SYSLOG="xxxxxxx/Syslog/syslog.log" # destination of the syslog on USB disk

where xxxxxx is the name/label of your USB drive (probably sda1 if there is no label)

Make the files 'executable'

i.e. if using WinSCP , right-click /jffs/scripts file in the right-hand pane (or select then PF9) then click the three 'X' boxes
or
from SSH command line issue
Code:
chmod a+rx /jffs/scripts/*

Finally test it
Code:
./syslog_move.sh

Follow the guides in the Wiki...for basic scripting etc.

https://github.com/RMerl/asuswrt-merlin/wiki
 
Last edited:
I've shortened the flash' lifespan haven't I?
No, no no. This is what I was referring to earlier. This obsession people have with thinking they are wearing out the flash is wrong and has been debunked here many times (including by Merlin himself).

a) flash memory technology has moved on since the early days, b) you cannot equate the write activity of computers to routers, c) the JFFS file system was specifically designed for flash memory. The spec's of the chips allow for any kind of activity the router will throw at it. The rest of the router will wear out (or become obsolete) before the memory.
 
Yes, I remember reading that. It is completely at odds with what he's subsequently said. :) Although the caveat is the phrase "high activity". syslog is not high activity and I would assume the traffic database isn't either otherwise Asus wouldn't have put it there.

Edit: Yes, Eric added the phrase "high activity" to that page in 2015.;)
 
Last edited:
Although the caveat is the phrase "high activity". syslog is not high activity and I would assume the traffic database isn't either otherwise Asus wouldn't have put it there.

What is considered high activity? As I've mentioned, my traffic.db is around 3.5 MB in size and it got to that in under 2 weeks. On average I'm seeing probably 15KB of data being written to that partition every day. I'm not too bothered about the syslog as that is quite small anyway, it's the traffic.db I'm more wary of.
 
What is considered high activity? As I've mentioned, my traffic.db is around 3.5 MB in size and it got to that in under 2 weeks. On average I'm seeing probably 15KB of data being written to that partition every day. I'm not too bothered about the syslog as that is quite small anyway, it's the traffic.db I'm more wary of.
In the post I linked to above, Eric uses the theoretical example of 1MB per day written over 32MB and concluded, "You will be dead and buried before your flash wears out...".
 
Yes, I remember reading that. It is completely at odds with what he's subsequently said. :) Although the caveat is the phrase "high activity". syslog is not high activity and I would assume the traffic database isn't either otherwise Asus wouldn't have put it there.

Hmm I thought /jffs is not the same as /tmp?

Anyway, wot's the adage.... "the internet never forgets", so inevitably there will always b a lot of undesirable 'confusion', however, it is unfortunate that a Google search using the phrase 'asus /jffs vs /tmp' shows the @RMerlin article as the third hit!

Given Asus are in the business to sell hardware, being the cynical bod that I am, Asus best-practice design decisions probably don't subscribe to the "ever-lasting light bulb" ethic?

Still whilst I too agree it isn't worth getting concerned over the MTBF for the router, I suspect most buyers would happily accept 2 years use as acceptable, but if it failed after say @18months I'm sure Asus would no doubt abjectly apologise by saying "oh dear, bit of a shame" but would then brightly respond, "...but hey! look, here is a nice new state-of-the-art Router with 20 Radios 16 ports etc. and there's 20% off RRP" :p:p


 
Hmm I thought /jffs is not the same as /tmp?
No they are not the same. I'm not sure I understand your point though.:)

The syslog is written to /tmp but when it reaches its size limit (or the router is rebooted) a copy of the logs is copied to /jffs (but not on 32MB routers). Actually, that's a good point because in syslog's case there in no constant writing** to /jffs because it's only copied every few days! I don't know about the traffic database because I use John's fork which doesn't have it. ;)

Anyway, I'm always looking for any excuse to buy new hardware. :D

** Although it makes no difference because of the chips wear levelling.
 
Last edited:
Thank you ColinTaylor. After reading your posts I feel more reassured that there is nothing to be too concerned about with the Router's flash performance and longevity.

At the very least, the AC68U comes with a 3 year warranty so it's covered ;)

@Martineau, thanks a lot for the detailed guide you have posted. Really appreciate it. I will have a go later this evening and let you know how I get on. Just some noobish questions. The two scripts, syslog_move.sh and init-start. Once I have created these within the /jffs/scripts directory do I need to copy and paste over the commands in post #6 to syslog_move.sh? Of course I'll change any variables to make it more relevant such as the source and destination.

As for the init-start script, what shall I paste there?

Thanks for being patient with me.
 
...do I need to copy and paste over the commands in post #6 to syslog_move.sh?

Yes, everything in the code box in post #6 should be cut'n'pasted into /jffs/scripts/syslog_move.sh
Of course I'll change any variables to make it more relevant such as the source and destination.

There should be no need to change the source???
As for the init-start script, what shall I paste there?.

To make my syslog move script 'portable' I documented/included a base init-start script as a comment header within the syslog_move.sh script.

..but to make it even easier I have expanded the comments as code, so simply cut'n'paste everything in this code box to /jffs/scripts/init-start (assuming of course that you don't already have an existing init-start script! :D)
Code:
#!/bin/sh

/usr/bin/logger -s -t "($(basename $0))" $$ "Martineau $MYROUTER BOOT in progress... [$@]"

MYROUTER=$(nvram get computer_name)
HARDWARE_MODEL=$(nvram get productid)
BUILDNO=$(nvram get buildno)
EXTENDNO=$(nvram get extendno)


# NOTE: Can't use Flash drive /tmp/mnt/$MYROUTER/ 'cos it hasn't been mounted yet :-(
# 'flock' is probably a better solution rather than the 'echo' ;-)
echo $$"-"`date` > /tmp/BOOTINPROGRESS

# Should be sufficient to cover physical BOOT process?
logger -st "($(basename $0))" $$ "Paused for 3 mins....."
sleep 180

# call custom scripts/commands e.g. cifs.sh / cru etc. here...

# Move Syslog to USB Flash drive
/jffs/scripts/syslog-move.sh

rm /tmp/BOOTINPROGRESS

/usr/bin/logger -st "($(basename $0))" $$ "Martineau" $MYROUTER "BOOT Completed Firmware build" $BUILDNO $EXTENDNO "[$@]"

exit 0
 
Last edited:
Couldn't you just write a small script to disable logging, move the contents, create a symlink to USB device, then re-enable logging?

EDIT: Never mind, (actually) read your script in 6. Carry on then... :)
 

Latest threads

Sign Up For SNBForums Daily Digest

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