Awstats anytime update

Below is a cut off, of the default cron file of ISPConfig 3.
Till, can we use it to update awstats, as frequently as we want?

My replacements:
- I removed every logrotate action you had and everything else, that had to do with modifying files
- I erased every yesterday variable and I used the default access.log for each website
- I tested it.

As I see after the tests, when I run it , then the stats REPLACED and updated for today. When the real cron runs every night, then the stats created with the above script, replaced again bringing us back to the state that ISPConfig wants. If (after 00:30) I run the script again, then the stats replaced again, but actually only the 'new' day is modified.

Actually, I have to run it, once, after the default cron (e.g. 00:40). That means, that I can have Greek and frequently updated stats WITHOUT even change a single line of the ISPConfig php files.

A suggestion:
Maybe ISPConfig could have an implementation like this. The default cron.daily could call a script to update stats and after that make the necessary rotations. With this, we could call the script anytime we want. Even through ISPConfig interface via a button.

I changed a lot the script (e.g. I removed the check for the second day of month). I tried it and it works.

Can anyone confirm it?

Till, I would appreciate it a lot, if you could take a look.

The concept is:
- If this is the first day of the month, go back one day and create the old stats and copy the previous month if only, the dir (year-month) does not exist, else do nothing. (This part will execute only once, and will not execute again if the folder will be created)
- Make the date correct
- Recreate the stats for today (this will execute as many times as the cron will calls this sript)

New code. Works good. Eliminates the problem of overwritten stats of previously month, the second day of the current month.

The logic, of the creation of awstats of the default cron, is that the second day of the month, the currently stats, are written in a new folder, repressenting the previously month.
This overwrites the stats already written in this folder by this script.
The new version corrects this.

One new addition, is the ability to recreate the stats from ANY month, as log as the data are in /var/lib/awstats or /var/cache/awstats.
Using this new feature
-first, you can correct any mistakes made by this script in the past and
-second, you can add ALL previously stats in the drop down menu.

The operations are:
- my script run at 23:55, so I had a full February report
- ISPConfig cron run at 00:30, so the normal operations took place
- my script run again at 00:40

Things are almost normal. The default page shows March statistics, but the drop down menu has 2012-2 checked. In fact there are 2 instances of 2012-2. The First is at the top of the list, representing the real February, and the Second is at the bottom of the drop down list, representing March.
The problem (which is not a real problem) is related with the code :

Do you use the latest file I upload?
As you will see in my previous posts, there is a problem only on the first day. Actually, it's not a problem, just a wrong item in the list, but only for the first day.
p.s.
I use the same script, with no problems.

Yes I do use the uploaded file. The weird thing is that, even with REDO=1, the latest days of august are not 'statistified', but the access logs are there and the permissions are in order... so that's why I'm unsure about the reason why it is not regenerating... any suggestion?