[Piwik-hackers] Enhanced Archive Cron Script
Matthieu Aubry
matthieu.aubry at gmail.com
Tue Jun 10 02:55:06 CEST 2008
This is now on svn and will be in next version: check the script on
http://dev.piwik.org/trac/browser/trunk/misc/cron/archive.sh?rev=521
This could be improved by getting the token_auth parameter automatically
by doing some magic reading the config file and calling the API to get
the token.
If anyone wants to try, that would be nice
(example api call to get the token from login+md5 password read from
config file)
http://piwik.org/demo/index.php?module=API&method=UsersManager.getTokenAuth&userLogin=YOUR_LOGIN&password=PASSWORD_READ_FROM_CONFIG+FILE&format=original
Soren Pedersen wrote:
> Thanks for that. Very usefull.
>
> I actually think this should be a core feature but this will works
> great until then.
>
>
> 2008/6/3, Claudio Moratti <maxer at knio.it <mailto:maxer at knio.it>>:
>
> 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 <mailto:maxer at knio.it>
> _______________________________________________
> Piwik-hackers mailing list
> Piwik-hackers at piwik.org <mailto:Piwik-hackers at piwik.org>
> http://lists.piwik.org/cgi-bin/mailman/listinfo/piwik-hackers
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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/20080610/a58d4b21/attachment.html
More information about the Piwik-hackers
mailing list