[Piwik-hackers] Enhanced Archive Cron Script
Matthieu Aubry
matthieu.aubry at gmail.com
Tue Jun 3 11:42:48 CEST 2008
Hi Claudio,
Good we actually did something similar and were planning to release the
script inside the piwik archive.
you can use the API to get the list of idsite in CSV and simply loop through
them in bash:
========
SITES=`"$PHP_BIN" "$PIWIK_PATH" --
"module=API&method=SitesManager.getAllSitesId&format=csv&token_auth=$TOKEN_AUTH"`
for IDSITE in $SITES; do
.....
done
On Tue, Jun 3, 2008 at 10:14 AM, Claudio Moratti <maxer at knio.it> wrote:
> 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
> _______________________________________________
> Piwik-hackers mailing list
> Piwik-hackers at piwik.org
> http://lists.piwik.org/cgi-bin/mailman/listinfo/piwik-hackers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.piwik.org/pipermail/piwik-hackers/attachments/20080603/7a587406/attachment.htm
More information about the Piwik-hackers
mailing list