The script has a bunch of variables at the top, followed by a series of methods, followed by the "main" code at the bottom.

It almost looks as though the Buffalo edition of sh is choking when it sees the first method. Or, more accurately, the opening brace of the method. It doesn't seem to understand what that is, and then chokes.

I don't know enough about shell scripts to know if this is a likely scenario, or even how I might prove/disprove the theory. I've been doing some Googling, but no obvious alternatives yet.

Progress! I started messing with a test script, copying over bits of bw_monitor to see if I could spot the problem.
In the end, if I made a new, empty file and copied/pasted the entire contents of my bw_monitor, then copied that to the router, it magically started to work.
It seems that the downloaded copy was somehow "damaged" in a way that wasn't obvious when staring at it in gedit.

It's still not fully functional. I can see mac_usage.db being updated, and the /tmp/www folder now contains the html file and the user_details.js file, and I can see *it* being updated too. But looking at monitor.html in the browser it still contains no actual data.

Progress! I started messing with a test script, copying over bits of bw_monitor to see if I could spot the problem.
In the end, if I made a new, empty file and copied/pasted the entire contents of my bw_monitor, then copied that to the router, it magically started to work.
It seems that the downloaded copy was somehow "damaged" in a way that wasn't obvious when staring at it in gedit.

It's still not fully functional. I can see mac_usage.db being updated, and the /tmp/www folder now contains the html file and the user_details.js file, and I can see *it* being updated too. But looking at monitor.html in the browser it still contains no actual data.

Interesting

I run each one before I check any code in.

I develop the script outside the router in notepad++ and copy and paste the code over into a new file (using the vim editor).

I then run chmod +x on it and then sh -n to check for syntax errors. It would seem manually copying over the contents into a new file is getting rid of any unsupported characters (introduced by notepad++), opposed to downloading the file and using it straight out of subversion (which must contain hidden invalid characters).

I found the issue, I am using windows character encoding s for line ends. I have since changed this to UNIX.

Looks like I will need to use a different type of encoding via notepad ++.

bpsmicro, you said you used gedit to modify the script, so i presume you could be a Debian our Ubuntu user(I'm Ubuntu user). I have noticed one curious thing when i browse files with nautilus (through sshfs) and edit files included in writable directories of a dd-wrt-box with gedit, it seems that i couldn't modify and save files this way(don't ask me why). So i modify files on my computer, then move it to the dd-wrt box or directly get it from a webserver via wget.

I should also mention somthing about specifying directories into the script.

For parameters that require a directory only (no file name included) they must be in the following way

/mnt/monitor/ - see how it has the last / at the end.

What the code does is assume that this is passed through, so I simply add the file name to the end of it.

For example history files.

_historyPath=/mnt/monitor/history/

the code does this cp $_macUsage $_historyPath'fileName'

I dont add slashes, this is supplied by the user.

Also, yes the system creates the backup file.

This will be created when the backup is first run which is every 'N' iteration of the update (set by the user through scrip parameters),_________________dd-wrt eko/V24-K26 15508
Belkin F7D4301
8MB Flash
64MB RAM

Thanks for the note on the History path. I think I need to fix that in my startup script.

And yzy, what I currently have is Ubuntu 10.10 in a virtual machine, with a share that I connect to from the router as /tmp/smbshare.
I download/edit/whatever all the files on the Ubuntu VM, and then telnet into the router and simply 'cp -f -p' from the smbshare to /mnt/mmc.

The only quirk is that the day counter seems stuck at 1 (meaning, the "Daily Breakdown") list is sticking everything at Day 1. The history path issue may be the cause of that, so I'll take a peek after my morning coffee. :-)

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