Cronjob Problem

Hi,

We are having a problem with the cronjobs after upgrading to Piwik 1.6 and the server people cannot figure out the problem so far. So the question is: does the cronjob for the autoarchiving script have to run as the www-data user? The setup guide says set it up as such
5 * * * * www-data /path/to/piwik/misc/cron/archive.sh > /dev/null.

Can it run as a different user then www-data as long as the user has execute permissions to the archive.sh script?

Thanks for the help!

The user it runs under must have write permissions to piwik/tmp/* folder as well, and it should work

Well, we tried it all, all settings are correct. It runs fine manually but in cronjob it does not work.

any error ? please be specific…

to test the script you should do something like “su www-data -c /bin/php …/archive.php”

It does not error, it just provides us with the help output such as:
[2011-12-11 09:18:31] [582aa729] [5.00 Mb]
[2011-12-11 09:18:31] [582aa729] [5.00 Mb] Usage: /path/to/cli/php archive.php [ []]
[2011-12-11 09:18:31] [582aa729] [5.00 Mb] : Piwik hostname eg. localhost, localhost/piwik
[2011-12-11 09:18:31] [582aa729] [5.00 Mb] : Current week/month/year will be processed at most every seconds. Defaults to 3600.
[2011-12-11 09:18:31] [582aa729] [5.00 Mb] : you can either specify
[2011-12-11 09:18:31] [582aa729] [5.00 Mb] - reset: the script will run as if it was never executed before, therefore will trigger archiving on all websites with some traffic in the last 7 days.
[2011-12-11 09:18:31] [582aa729] [5.00 Mb] You can specify a number of seconds to use instead of 7 days window, for example call archive.php 1 reset 86400 to archive all reports for all sites that had visits in the last 24 hours
[2011-12-11 09:18:31] [582aa729] [5.00 Mb] - forceall: the script will trigger archiving on all websites for all periods, sequentially
[2011-12-11 09:18:31] [582aa729] [5.00 Mb] - reset+forceall: you can also specify both, which is effectively the same behavior
[2011-12-11 09:18:31] [582aa729] [5.00 Mb] as the slower script archive.sh. The only added optimization: it does not trigger archiving for periods
[2011-12-11 09:18:31] [582aa729] [5.00 Mb] if the last 52 days have no data at all.
[2011-12-11 09:18:31] [582aa729] [5.00 Mb]
[2011-12-11 09:18:31] [582aa729] [5.00 Mb] This script should be executed every hour, or as a deamon.
[2011-12-11 09:18:31] [582aa729] [5.00 Mb]
[2011-12-11 09:18:31] [582aa729] [5.00 Mb] For more help and documentation, try $ /path/to/cli/php archive.php help
[2011-12-11 09:18:31] [582aa729] [5.00 Mb]

You need to pass it the URL to piwik as first parameter to script, eg. /path/piwik/misc/cron/archive.php domain/path/piwik/

OK, we did that. No errors when running it manually, again nothing happens when added to crontab.

The output you pasted earlier is what happens when there is no parameter… ? what is the output you get from the cron log file?