sssemil / wrtbwmon

Automatically exported from code.google.com/p/wrtbwmon
0 stars 0 forks source link

USERSFILE as Arg ${4} not working #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Latest build using USERFILE as Arg ${4}

What is the expected output? What do you see instead?
Doesn't read USERFILE correctly. Shows hostnames from presumably
/tmp/dnsmasq.conf for those with static IPs and ignores any other
hosts on the network and displays a MAC address.

What version of the product are you using? On what operating system?
Download:  Latest version (build 40)  
Uploaded by:  emmanuel.brucy 
Uploaded:  Jan 08, 2010  
SHA1 Checksum: 19e08ad956a16c40a1c305dccc1f03e5450b71a4
Buffalo whr-hp-g54 with DD-WRT v24 sp2 std

Please provide any additional information below.
Possibly a typo? Not sure this fixes it though.
Typo on line 141?   [ -z "${4}" ] || USERFILE=${4}
Replace with    [ -z "${4}" ] || USERSFILE=${4}

Original issue reported on code.google.com by ben.swin...@gmail.com on 3 Feb 2010 at 4:36

GoogleCodeExporter commented 9 years ago
Good catch, this is a bug indeed. Fixed.

Original comment by emmanuel...@gmail.com on 3 Feb 2010 at 4:53

GoogleCodeExporter commented 9 years ago
Good catch, this is a bug indeed. Fixed. Thank you very much for your feedback !

Original comment by emmanuel...@gmail.com on 3 Feb 2010 at 4:53

GoogleCodeExporter commented 9 years ago
Have you tested this fix? I've made no changes other than to download Build 41 
and I 
still don't get custom names, just MAC addresses? If you can confirm that this 
fix 
has worked then I can look elsewhere for a resolution to this problem.

Thanks for the quick update.

Original comment by ben.swin...@gmail.com on 3 Feb 2010 at 5:04

GoogleCodeExporter commented 9 years ago
Yes I made a quick test and it was working again. Have you checked your user 
file is
in the right format ? (ie mac adresses with uppercase letters, with : as 
separators)

Original comment by emmanuel...@gmail.com on 3 Feb 2010 at 5:23

GoogleCodeExporter commented 9 years ago
Re-tested it again, it definitely works.

Original comment by emmanuel...@gmail.com on 3 Feb 2010 at 5:25

GoogleCodeExporter commented 9 years ago
Having changed nothing at my end I'm struggling to see what the problem might 
be. My 
apologies if this isn't the right place to ask questions but I'm a bit stuck. 
Nothing has changed here so I'm asuming it must be something to do with your 
update 
and my router / version of dd-wrt so any help you may be able to offer is much 
appreciated. Maybe you know a way to debug the script easily or maybe I'm just 
doing 
something fundamentally wrong?

My setup is as follows:

// Contents of /tmp
root@fw0:/tmp# ls -la wrtbwmon users.txt usage.db www/usage.htm
-rw-r--r--    1 root     root          723 Feb  3 18:00 usage.db
-rw-r--r--    1 root     root          711 Feb  3 18:07 users.txt
-rwxr-xr-x    1 root     root         7419 Feb  3 16:58 wrtbwmon
-rw-r--r--    1 root     root         2282 Feb  3 18:11 www/usage.htm

// Crontab entries
# Download script if it doesn't exist
* * * * * root [ ! -f /tmp/wrtbwmon ] && wget 
http://wrtbwmon.googlecode.com/files/wrtbwmon -O /tmp/wrtbwmon && chmod 
+x /tmp/wrtbwmon
# Download users.txt if it doesn't exist
* * * * * root [ ! -f /tmp/users.txt ] && wget http://path/to/users.txt -
O /tmp/users.txt && chmod +r /tmp/users.txt
# Setup script to track connected hosts
* * * * * root sh /tmp/wrtbwmon setup br0
# Update peak database rest of day
*/30 0-15 * * * root sh /tmp/wrtbwmon update /tmp/usage.db offpeak
# update peak database 16:00 to 20:59
*/30,59 16-20 * * * root sh /tmp/wrtbwmon update /tmp/usage.db peak
# Update peak database rest of day
*/30 21-23 * * * root sh /tmp/wrtbwmon update /tmp/usage.db offpeak
# Publish usage file
*/1,31 * * * * root sh /tmp/wrtbwmon 
publish /tmp/usage.db /tmp/www/usage.htm /tmp/users.txt

//Running the terminal command directly doesn't add the names either
sh /tmp/wrtbwmon publish /tmp/usage.db /tmp/www/usage.htm /tmp/users.txt

// users.txt is as follows with the last two sections replaced with 99
00:18:38:02:99:99=Jason (Oli)
00:18:DE:9A:99:99=Jason (Laptop)
00:1A:92:5B:99:99=Jason (Unknown)
00:15:AF:0E:99:99=Jason (Desktop)
00:14:A5:BE:99:99=Ben (Laptop)
00:1F:D0:D0:99:99=Ben (Desktop)
00:17:FA:C6:99:99=Ben (Xbox)
00:03:2F:4F:99:99=Ben (Extender)
00:24:BE:D4:99:99=Ben (HDTV)
00:C0:A8:D0:99:99=Bridget (Laptop)
00:1F:33:EE:99:99=Kylie (Laptop)
00:1F:C5:FF:99:99=Kylie (Wii)
00:16:CB:BE:99:99=Steph (Macbook)
D4:9A:20:1C:99:99=Steph (iPod)
04:1E:64:ED:99:99=Steph (iMac)
00:16:CE:13:99:99=Harry (Laptop)
00:25:00:4C:99:99=James (Macbook)
00:16:E6:82:99:99=James (Unknown)
00:1F:E2:53:99:99=James (Desktop)
00:21:E9:22:99:99=James (iPhone)
00:19:E3:02:99:99=James (Emilia)
00:25:AE:19:99:99=James (Xbox)

Original comment by ben.swin...@gmail.com on 3 Feb 2010 at 6:25

GoogleCodeExporter commented 9 years ago
No worries, just replace the = with , in your users.txt.

FYI, the equals sign was the old format of the users file, then I switched to 
comas
in revision 31 (mid june 2009) to be able to use static leases from 
dnsmasq.conf.

Original comment by emmanuel...@gmail.com on 3 Feb 2010 at 6:50

GoogleCodeExporter commented 9 years ago
Ah brilliant. Didn't expect that sort of change so hadn't been looking for it. 
My 
router hasn't been off since before then so it's always worked with =. Many 
thanks 
for your support and your work on the project.

Ben

Original comment by ben.swin...@gmail.com on 3 Feb 2010 at 10:15