The Personal Email Reports function is inconsistent on my system.
I’ve scheduled 2 reports @ 8 o'clock UTC.
Sometimes I receive reports @ 9:09 or 10:43 but mostly I do not receive any reports al all.
The scheduler is not working as it supposed to be. Is there anything I can do or check?
I’m running Matomo 3.7.0 on Ubuntu 16.04 with Apache and MariaDB.
Quick question: Do you habe cron set up?
I am familiar with crons but how can I set this up for Matomo?
PHP programs don't run permanently, but just when they are accessed. So the only times when Matomo can do something is when e.g. you log into Matomo or someone visits your website. Then Matomo aggregates the raw data and does scheduled tasks.
If you want reports to be already generated when you access Matomo and emails to be sent on time, you can instruct your server to call Matomo in regular intervals. On Linux (and co.) this can be done with the great tool
cron (on Windows there is a similar Tool).
How exactly you do this depends a lot on your Server environment, but the most popular ones are explained here:
As @Findus23 pointed out you will need to set up a cronjob to run for example hourly (recommended) and ideally also disable browser archiving as mentioned in the guide (will also give your Matomo a performance boost). Let us know if this doesn't fix your problem.
I run many shell scripts on my Linux machines via cron.
Do I need to run the following task hourly via cron to fix my scheduled tasks?
/usr/local/bin/php -f /home/yourcpanelsitename/public_html/piwik/console core:archive --url=example.org/piwik/ > /home/example/piwik-archive-output.log
@snomisneb Exactly But of course with the correct php path, matomo path and url.
Of course, I will give it a try today.
Thanks for your help so far.
I have had the email report-scheduler working for some time due to the archive-cron setup but now I’m struggling again on a new server (Ubuntu 18.04).
I have setup the same archive-cron, but I can’t get it to work on the new Ubuntu 18.04 server.
The manual-email-report function works fine. I’m searching for a solution now for 2 weeks but I’m out of options and hope you can help me again.
I guess this has something to-do with PHP 7.2.
Check all kind of webserver and PHP error logs to see if you find something in there. You might also want to enable the file logger to see if some error occurs in Matomo https://matomo.org/faq/troubleshooting/faq_115/
I’m scanning all logs on a daily basis for about 2 weeks now, but I can’t find any problems.
Below some small snippets of the Matomo-cronjob-log.
INFO [2018-12-28 07:00:02] 28757 SCHEDULED TASKS
INFO [2018-12-28 07:00:02] 28757 Starting Scheduled tasks...
INFO [2018-12-28 07:00:02] 28757 Scheduler: executing task Piwik\Plugins\ScheduledReports\API.sendReport_8...
INFO [2018-12-28 07:00:05] 28757 Scheduler: finished. Time elapsed: 3.168s
INFO [2018-12-28 07:00:05] 28757 Scheduler: executing task Piwik\Plugins\ScheduledReports\API.sendReport_9...
INFO [2018-12-28 07:00:08] 28757 Scheduler: finished. Time elapsed: 2.393s
INFO [2018-12-28 07:00:08] 28757 Scheduler: executing task Piwik\Plugins\ScheduledReports\API.sendReport_10...
INFO [2018-12-28 07:00:09] 28757 Scheduler: finished. Time elapsed: 1.772s
INFO [2018-12-28 07:00:09] 28757 Scheduler: executing task Piwik\Plugins\ScheduledReports\API.sendReport_11...
INFO [2018-12-28 07:00:10] 28757 Scheduler: finished. Time elapsed: 1.056s
INFO [2018-12-28 07:00:10] 28757 Scheduler: executing task Piwik\Plugins\CustomPiwikJs\Tasks.updateTracker...
INFO [2018-12-28 07:00:10] 28757 Scheduler: finished. Time elapsed: 0.002s
INFO [2018-12-28 07:00:10] 28757 Scheduler: executing task Piwik\Plugins\PrivacyManager\Tasks.anonymizePastData...
INFO [2018-12-28 07:00:10] 28757 Scheduler: finished. Time elapsed: 0.000s
INFO [2018-12-28 07:00:10] 28757 done
I have enabled PHP error logging on the machine, but this logfile is still empty.
The Apache2 access and error logs also look fine.
Do you know which PHP packet is responsible for the scheduled reports?
I know the PHP-mcrypt package isn’t in the PHP 7.2 repositories.
Not sure what you mean by "PHP packet"? We simply use http://us2.php.net/manual/en/function.mail.php AFAIK