Archiving via cron doesn't work

While testing, I have set “Allow Piwik archiving to trigger when reports are viewed from the browser” to “No” and “Reports for today (or any other Date Range including today) will be processed at most every seconds” to 120 seconds.

I have a cron job which runs every minute, in /etc/cron.d/piwik-archive (I have removed personal information):

MAILTO="mymail@example.com"

          • www-data /usr/bin/php /data/www/website/piwik/console core:archive --url=http://daj.bing.example.com/piwik/ > /home/daj/piwik_archive/piwik-archive.log

After a few visits to the site with two of different browsers, this is the piwik-archive.log file:

daj@kingo:~/piwik_archive$ more piwik-archive.log
INFO CoreConsole[2014-04-29 12:54:02] [5170f] ---------------------------
INFO CoreConsole[2014-04-29 12:54:02] [5170f] INIT
INFO CoreConsole[2014-04-29 12:54:02] [5170f] Piwik is installed at: http://daj.bing.example.com/piwik/index.php
INFO CoreConsole[2014-04-29 12:54:02] [5170f] Running Piwik 2.2.0 as Super User
INFO CoreConsole[2014-04-29 12:54:02] [5170f] ---------------------------
INFO CoreConsole[2014-04-29 12:54:02] [5170f] NOTES
INFO CoreConsole[2014-04-29 12:54:02] [5170f] - Reports for today will be processed at most every 120 seconds. You can change this value in Piwik UI > Settings > General Settings.
INFO CoreConsole[2014-04-29 12:54:02] [5170f] - Reports for the current week/month/year will be refreshed at most every 3600 seconds.
INFO CoreConsole[2014-04-29 12:54:02] [5170f] - Archiving was last executed without error 1 min 0s ago
INFO CoreConsole[2014-04-29 12:54:02] [5170f] - Will process 0 websites with new visits since 1 min 0s
INFO CoreConsole[2014-04-29 10:54:02] [5170f] ---------------------------
INFO CoreConsole[2014-04-29 10:54:02] [5170f] START
INFO CoreConsole[2014-04-29 10:54:02] [5170f] Starting Piwik reports archiving…
INFO CoreConsole[2014-04-29 10:54:02] [5170f] Done archiving!
INFO CoreConsole[2014-04-29 10:54:02] [5170f] ---------------------------
INFO CoreConsole[2014-04-29 10:54:02] [5170f] SUMMARY
INFO CoreConsole[2014-04-29 10:54:02] [5170f] Total visits for today across archived websites: 0
INFO CoreConsole[2014-04-29 10:54:02] [5170f] Archived today’s reports for 0 websites
INFO CoreConsole[2014-04-29 10:54:02] [5170f] Archived week/month/year for 0 websites
INFO CoreConsole[2014-04-29 10:54:02] [5170f] Skipped 1 websites: no new visit since the last script execution
INFO CoreConsole[2014-04-29 10:54:02] [5170f] Skipped 0 websites day archiving: existing daily reports are less than 120 seconds old
INFO CoreConsole[2014-04-29 10:54:02] [5170f] Skipped 0 websites week/month/year archiving: existing periods reports are less than 3600 seconds old
INFO CoreConsole[2014-04-29 10:54:02] [5170f] Total API requests: 0
INFO CoreConsole[2014-04-29 10:54:02] [5170f] done: 0/0, 0 vtoday, 0 wtoday, 0 wperiods, 0 req, 25 ms, no error
INFO CoreConsole[2014-04-29 10:54:02] [5170f] Time elapsed: 0.025s
INFO CoreConsole[2014-04-29 10:54:02] [5170f] ---------------------------
INFO CoreConsole[2014-04-29 10:54:02] [5170f] SCHEDULED TASKS
INFO CoreConsole[2014-04-29 10:54:02] [5170f] Starting Scheduled tasks…
INFO CoreConsole[2014-04-29 10:54:02] [5170f] No task to run
INFO CoreConsole[2014-04-29 10:54:02] [5170f] done
INFO CoreConsole[2014-04-29 10:54:02] [5170f] ---------------------------

If I change “Allow Piwik archiving to trigger when reports are viewed from the browser” to “Yes” and view the frontpage, “Visits over time” is updated, and the two visits are added. So it seems like the visits are not detected by the archiving cron job.

Do you know what might be wrong?

please apply this patch and try again: Setting the default timezone to UTC in the core:archive script, refs … · matomo-org/matomo@22e8a7a · GitHub

Thank you very much for the fast answer, it works now :)-D

This bug is fixed in the latest release of Piwik (2.2.1): piwik.org/changelog/piwik-2-2-1/
See ticket #5043