Error with cron.php

Good morning,

I have created my Nextcloud platform with the latest version on an Ubuntu Server 20.04 LTS following all the steps one by one.
The problem comes with background jobs.
I have configured the cron as it comes in the documentation with a ‘crontab -u www-data -e’ adding the indicated line at the end. Now, once this is configured I get the following error: “The last execution of a job was 18 minutes ago. Something seems to be wrong.”
However, looking at this error I can see that the counter never goes past 18 minutes. That is, once the message should be “The last execution of a job was 18 minutes ago. Something seems to be wrong” what appears is “The last execution of a job was 14 minutes ago. Something seems to be wrong” which makes me suspect that the background jobs are running correctly every 5 minutes but they appear to be out of time and that is why this error appears.

Thank you very much.

Hi Victor,

you should provide a little bit more information:

What apps do you have installed? Are you using Recognize? Do you have much files/users?

Did you monitor it live with top?

Hi,
We don’t have so much files or users. We are not using Recognize and the number estimated of apps is nowadays around 50.
However, this error occurs even when the number of apps was aproximately 10.
After studying it, the cron service runs correctly every five minutes but in the basic settings is displayed that it was 14-18 minutes ago, it seems like it is working properly with a time lag (as you can see in the screenshot)

Update: I have noticed that the notifications are sent with a delay of 15 minutes also, so maybe it has something to do with the configuration of the delay.
Any idea?

There are various debug options.

You can watch your cron processes live in a terminal with this command:

 watch -n 3 'pstree -aclus $(pgrep -o cron)'

but you have to stay with your eyes on it, because it refreshes every 3 seconds.

Then you can look what your server does when cron is called how I described here:

I don’t think that the error comes from the cron.php.
I have been researching and I see that when I send a message on Talk, the hour that comes out is 14 before the actual time, so probably the error is not from cron.
I mean, in the screenshot, I sent a message in the actual time 13.01 but in Nextcloud, the hour that comes out is 12.47. So probably if I solve it, the error with cron will be solved.
Any ideas on how to solve it?
(

Here are some time related search strings:

php -i | grep time
datetimezonectl

and

sudo -u www-data php -f /var/www/nextcloud/occ config:system:get logtimezone

(if set)

I have finally solved it changing manually the hour of my VM which was the original problem, not a problem of Nextcloud.
Thank you very much!

That was exactly what I meant with

It is that type of error that could have been predicted with ease, whith the information that it is running in a VM. Finally the output of datetimezonectl was your eyeopener, am I right?