Cron.php does not work

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 23.0.12
Operating system and version (eg, Ubuntu 20.04): Opensuse Leap 15.4
Apache or nginx version (eg, Apache 2.4.25): 2.4.51
PHP version (eg, 7.4): 7.4

The issue you are facing:

I have Nextcloud Hub II (23.0.12) on a Opensuse Leap 15.4
Recently I see a warning that cron have not been running for a while.
I had a entry in /etc/crontab setting the id to run to wwwrun (my apache user) it failed because “wwrun password have expired”. I made some changes and move the entry to the wwwrun crontab

aldebaran:/srv/www/htdocs/nextcloud # crontab -u wwwrun -l
*/5 * * * * /usr/bin/php -f  /srv/www/htdocs/nextcloud/cron.php  >/srv/www/htdocs/nextcloud/data/cron.log  2>&1

I added the redirection to cron.log to test what happen.
The file cron.log is touched every 5 minutes, so the crontab job is working, but the cron.log remains empty.

If I run

aldebaran:/srv/www/htdocs/nextcloud # sudo -u wwwrun /usr/bin/php -f  /srv/www/htdocs/nextcloud/cron.php

It does not return any error … but it does not return anything. And still it does not work

Same if I change cron to webcron and I enter in a browser

https://myserver/nextcloud/cron.php

it does not return any error but it shows a blank page.

What can I test?

You can do this:

Install (if not yet installed) the command-line JSON processor jq:

on SUSE:

sudo zypper install jq

Go to your config/config.php and set loglevel to “0”

open a terminal and enter this command:

tail -F /path/to/your/nextcloud.log | jq 'select(.app == "cron")'

Don’t forget to switch loglevel back to “2”, as soon as you found what you where looking for.

Did you fix the expired password?

yes, I did

I change error level and run the tail program, I open another terminal and run

aldebaran:~ # sudo -u wwwrun /usr/bin/php -f  /srv/www/htdocs/nextcloud/cron.php

and in the tail log show

{
  "reqId": "Es8WnzHlnlEBCPtO8j5b",
  "level": 0,
  "time": "2023-03-23T23:01:46+00:00",
  "remoteAddr": "",
  "user": "--",
  "app": "cron",
  "method": "",
  "url": "--",
  "message": "CLI cron call has selected job with ID 6563",
  "userAgent": "--",
  "version": "23.0.12.2",
  "data": {
    "app": "cron"
  }
}
{
  "reqId": "Es8WnzHlnlEBCPtO8j5b",
  "level": 0,
  "time": "2023-03-23T23:01:46+00:00",
  "remoteAddr": "",
  "user": "--",
  "app": "cron",
  "method": "",
  "url": "--",
  "message": "Run OCA\\Maps\\BackgroundJob\\AddPhotoJob job with ID 6563",
  "userAgent": "--",
  "version": "23.0.12.2",
  "data": {
    "app": "cron"
  }
}


as here, twice for each time I run the cron.php,
but still I have the warning: Last background job execution ran 3 days ago. Something seems wrong. Check the background job settings

I saw this

 "reqId": "Es8WnzHlnlEBCPtO8j5b", 
 "level": 0, 
 "time": "2023-03-23T23:01:46+00:00", 
 "remoteAddr": "", 
 "user": "--", 
 "app": "cron", 
 "method": "", 
 "url": "--", 
 "message": "Run OCA\\Maps\\BackgroundJob\\AddPhotoJob job with ID 6563", 
 "userAgent": "--", 
 "version": "23.0.12.2", 
 "data": { 
   "app": "cron"

And I found here that it was a error of the maps app.

I deleted the app, the cron run, althout it took some hours to finish. Then I reinstalled the maps app to test if it will work and it is working with the maps app.