[Piwik-hackers] Enhanced Archive Cron Script
Claudio Moratti
maxer at knio.it
Tue Jun 3 11:14:00 CEST 2008
Hi!
My name is Claudio, and this is my first message on this mailing-list :)
I have started using piwik one week ago, in order to collect
statistics about the Italian Debian Community (
http://www.debianizzati.org ).
There are 4 section, for a total of 2000 visits every day... If could
be useful, I can send information about how piwik works in this
situation ;)
I notice a nice Cron for an automatic archiving task, but it is linked
only to one site...
I wrote this small bash script, that can extract all 'idsite' and
process everyone...
Hope this can help someone ;)
==
#!/bin/bash
USER="piwik-user"
PASSWORD="piwik-pass"
DATABASE="piwik"
PIWIK_PATH="/var/www/piwik/"
TOKEN="theadmintoken"
AUTH="-u $USER -p$PASSWORD"
for ID in ` mysql $AUTH -D $DATABASE -Bse 'SELECT idsite FROM piwik_site'`
do
/usr/bin/php5 $PIWIK_PATH/index.php --
"module=API&method=VisitsSummary.getVisits&idSite=$ID&period=year&date=today&format=original&token_auth=$TOKEN"
> /dev/null
/usr/bin/php5 $PIWIK_PATH/index.php --
"module=API&method=VisitsSummary.getVisits&idSite=$ID&period=week&date=last52&format=xml&token_auth=$TOKEN"
> /dev/null
done
==
cheers
claudio
--
Claudio Moratti
maxer at knio.it
More information about the Piwik-hackers
mailing list