That's what I thought. So it *is* executable according to the attributes. But having made that mistake more than once before, it's still a valid thing to check first. :-)
I'm beginning to wonder if the Buffalo-specific dd-wrt is coming into play. On my router the '/bin/sh' command is linked to 'busybox'. Is that normal for dd-wrt?
Here's what I think, and a shell expert may have some thoughts...
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 ++.
The html browser is looking for the JS file by this http://192.168.1.1/user/user_details.js. You will have to update this in the HTML if this is not correct for you.
Thats probably a feature I should add, allow a user to set this path via script arguments. I think I will .
The current code is 0.8 and has some fixes in there as well. (also updated ALL files for unix ).
This is great, as I said im SH newbie as well and all my development experience is .NET and Windows Based.
This feedback is in-valuable to me as I just dont know what can go wrong, hence why I want people to get it down and use it.
I want people to list issues or question about missing information. I want this to be an easy 2-3 step process and then your away laughing.
At the moment, I have 2 people testing this who are at 2 ends of the linux experience level spectrum.
This is exactly what I need. Ill use all these issues and create a comprehensive installation doc for it. _________________ dd-wrt eko/V24-K26 15508
Belkin F7D4301
8MB Flash
64MB RAM
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. :-)
Yeah, one of the side effects of leaving it as the defaults (for the optional ones) is that I record everythiong under day 1. This was for those people that didn have access to much space.
Basically what you are seeing is what the wrtbwmon script does, records usage regardless of what day.
To enable daily usage you have to pass through the last optional parameter as 1.
This should be your startup script.
I have modifed it for you, but I have everything enabled and I store the usage data in memory only. If you want this, instead of supplying /tmp/mac_usage.db, pass through 1 instead.
Also note I am using the default javascript output path which in this case is triggerd by no value being supplied (system defaults it to /tmp/www/).
What I need to do is create a nice diagram which illustrates exactly what option does what.