charly22 / wrtbwmon

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

Cannot generate daily reports (cp of usage.htm at end of day with dynamic filenaming) #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. use the following line without the brackets in cron job in Administration 
tab: [55 23 * * * root /mnt/wrtbwmon publish /mnt/usage.db /mnt/usage-`date 
+%d%b%Y`.htm]
2. wait until 11:55PM, 5 minutes from midnight to see if report is generated

What is the expected output? What do you see instead?

I expect the usage.htm file to be generated, with a filename based on the day, 
month, and year - like: usage-22June2010.htm

I don't see the file created. usage.htm is created regularly using the cron job 
code from the deployment wiki. When I run the line manually by SSH'ing into the 
router it creates the file just fine.

What version of the product are you using? On what operating system?
Followed the deployment wiki as of 3 days ago. Using DD-WRT v24-sp2 mega build 
on ASUS WL-500g Premium V2. Ubuntu 10.04/Windows 7 Pro 64bit.

Please provide any additional information below.

Original issue reported on code.google.com by AegisDrgn@gmail.com on 23 Jun 2010 at 7:52

GoogleCodeExporter commented 8 years ago
Errr..forgot to mention that I have a USB drive mounted on /mnt. This is my 
entire cron job code block:

* * * * * root /mnt/wrtbwmon setup br0
*/15 0-3 * * * root /mnt/wrtbwmon update /mnt/usage.db peak
*/15 4-12 * * * root /mnt/wrtbwmon update /mnt/usage.db offpeak
*/15 13-23 * * * root /mnt/wrtbwmon update /mnt/usage.db peak
*/15 * * * * root /mnt/wrtbwmon publish /mnt/usage.db /tmp/www/usage.htm
*/15 * * * * root /mnt/wrtbwmon publish /mnt/usage.db /mnt/usage.htm
55 23 * * * root /mnt/wrtbwmon publish /mnt/usage.db /mnt/usage-`date 
+%d%b%Y`.htm
5 0 * * * root rm /mnt/usage.db

Original comment by AegisDrgn@gmail.com on 23 Jun 2010 at 7:55

GoogleCodeExporter commented 8 years ago
I am almost certain the `date +%d%b%Y` part in a cron command will not work.

As a workaround, I would create a script with this content :

#!/bin/sh
/mnt/wrtbwmon publish /mnt/usage.db /mnt/usage-`date +%d%b%Y`.htm

and calling it as the crom command, ie.
55 23 * * * root /mnt/generate_daily_report.sh

Original comment by emmanuel...@gmail.com on 23 Jun 2010 at 8:31

GoogleCodeExporter commented 8 years ago
It worked! Thanks a bunch Emmanuel!

Original comment by AegisDrgn@gmail.com on 24 Jun 2010 at 1:42

GoogleCodeExporter commented 8 years ago
Closing issue

Original comment by emmanuel...@gmail.com on 3 Jul 2010 at 6:52