Hi everyone
I am on Ubuntu 22.04, Matomo latest version, PHP 8.3, and I have an issue with Auto-archiving reports cron not working as it should.
I keep getting this popup but the websites has traffic to it all the time:
My /etc/cron.d/matomo-archive
file has multiple archivers setup in the file:
MAILTO="youremail@example.com"
5 * * * * domain.com /usr/bin/php /path/to/matomo/console core:archive --url=https://www.domain.com/matomo/ > /dev/null
6 * * * * domain.com /usr/bin/php /path/to/matomo/console core:archive --url=https://www.domain.com/matomo/ > /dev/null
7 * * * * domain.com /usr/bin/php /path/to/matomo/console core:archive --url=https://www.domain.com/matomo/ > /dev/null
8 * * * * domain.com /usr/bin/php /path/to/matomo/console core:archive --url=https://www.domain.com/matomo/ > /dev/null
9 * * * * domain.com /usr/bin/php /path/to/matomo/console core:archive --url=https://www.domain.com/matomo/ > /dev/null
10 * * * * domain.com /usr/bin/php /path/to/matomo/console core:archive --url=https://www.domain.com/matomo/ > /dev/null
I also got this file /etc/cron.d/0hourly setup to run hourly jobs
# Run the hourly jobs
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
1 * * * * root run-parts /etc/cron.hourly
The user setup looks to be correct, when I run the manual command to archive reports it works.
I tried this:
sudo systemctl restart cron
the I checked the logs to see if I am getting any errors for cron jobs:
journalctl -u cron | grep matomo-archive
and surprise surprise, I am getting this error:
Nov 26 02:07:01 my.server cron[680521]: (*system*matomo-archive) RELOAD (/etc/cron.d/matomo-archive)
Nov 26 02:07:01 my.server cron[680521]: (*system*matomo-archive) ERROR (Missing newline before EOF, this crontab file will be ignored)
Nov 26 02:19:30 my.server cron[2819933]: Error: bad username; while reading /etc/cron.d/matomo-archive
Nov 26 02:19:30 my.server cron[2819933]: (*system*matomo-archive) ERROR (Syntax error, this crontab file will be ignored)
Nov 26 02:21:01 my.server cron[2819933]: (*system*matomo-archive) RELOAD (/etc/cron.d/matomo-archive)
Nov 26 02:36:01 my.server cron[2823991]: (*system*matomo-archive) RELOAD (/etc/cron.d/matomo-archive)
Nov 26 02:43:01 my.server cron[2830266]: (*system*matomo-archive) RELOAD (/etc/cron.d/matomo-archive)
The user rights are correct though, and i have a new line at the end of the file.
Any idea what I am missing here?
I’m scratching my head : /
PS: Note that my username is domain.com
and it might be conflicting for Linux commands, but I never had this issue a few months ago, and I had similar usernames as domain.com
.