Quantcast
Channel: Support & Bugs - Matomo forums
Viewing all articles
Browse latest Browse all 5981

Set up Cron not working at all

$
0
0

Hi

I have Matomo self-hosted installed on a server that runs Rocky Linux 8.7 and these specs

Matomo version: 4.14.1
MySQL version: 10.3.35-MariaDB
PHP version: 8.1.17

and I am trying to fix this recommendation in Administration > Diagnostic > System Check:

Set up Cron (faster report-loading)
For optimal performance and a speedy Matomo, it is highly recommended to set up a crontab to automatically archive your reports, and to disable browser triggering in the Matomo settings. Learn more."

I followed the guide here , created the /etc/cron.d/matomo-archive file and tweaked these lines:

MAILTO="youremail@example.com"
5 * * * * www-data /usr/bin/php /path/to/matomo/console core:archive --url=http://example.org/matomo/ > /home/example/matomo-archive.log

I added my own email and for the 2nd line I tried to find the correct paths, where domain.com is the domain I used to set it up on:

  • www-data is supposed to be an user but in my case the username created for this domain has the same name as the domain, so it was domain.com
  • /usr/bin/php i checked it using which php and got the same path
  • /path/to/matomo/console in my case I figured out it is /home/domain.com/public_html/analytics (I created a subfolder analytics where I installed Matomo instead of root)
  • http://example.org/matomo/ is my Matomo URL path: https://domain.com/analytics/
  • /home/example/matomo-archive.log is this path I figured /home/domain.com/public_html/analytics/matomo-archive.log

So my final 2 code lines that I updated inside file /etc/cron/d/matomo-archive became:

MAILTO="hello@domain.com"
5 * * * * domain.com /usr/bin/php /home/domain.com/public_html/analytics core:archive --url=https://domain.com/analytics/ > /home/domain.com/public_html/analytics/matomo-archive.log

In the instructions it says

/path/to/matomo/console is the path to your Matomo app on your server. For example it may be /var/www/matomo/console

I am not sure if my path is correct to be honest, as I couldn’t find anything in /var/www/matomo : (

So then I modified this command as per guide above:

su www-data -s /bin/bash -c "/usr/bin/php /path/to/matomo/console core:archive --url=http://example.org/matomo/"

to this command:

su domain.com -s /bin/bash -c "/usr/bin/php /home/domain.com/public_html/analytics core:archive --url=https://domain.com/analytics/"

and ran it in the terminal in order to test if the crontab is working; when I ran it in the terminal, nothing happened, it did not give any error or message or showed any domains.

I think I have made a mistake somewhere but I keep going back and can’t find the solution to this.

I’ve really tried different things to fix this but I still can’t get the crontab working. I even tried changing the username in the file to root and ran the same command with su root -s ... but no success either.

If anyone has any advice on this how to get the crontab working, would be soo grateful!

Thank you so much!

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 5981

Trending Articles