Nextcloud keeps stating cron.php hasn't ran, cron logs say otherwise

Nextcloud version: 21.0.3
Operating system and version: Debian GNU/Linux 10 (buster)
Apache version: Apache/2.4.38 (Debian)
PHP version: 7.4.21

Output of cron log:

Jul 18 19:30:00 <hostname> CRON[1482]: (www-data) CMD (php -f /var/www/html/cron.php)

Output of Nextcloud overview:

Last background job execution ran 1 hour ago. Something seems wrong.

Cron.php permissions:

-rwx------ 1 www-data www-data 5.1K Jul 18 18:30 /var/www/html/cron.php

Cron:

sudo cat /etc/cron.d/nextcloud-php-cron

*/5 * * * * www-data php -f /var/www/html/cron.php

(Yes, I’ve put it in the cron.d folder, I did have it configured on the www-data’s crontab, but got the same results).

I’ve made sure all the software is up to date via Apt, there’s no updates to install, here’s the list of my sources:

/etc/apt/sources.list

deb http://deb.debian.org/debian/ buster main
deb-src http://deb.debian.org/debian/ buster main
deb http://deb.debian.org/debian/ buster-updates main
deb-src http://deb.debian.org/debian/ buster-updates main
deb http://security.debian.org/debian-security buster/updates main
deb-src http://security.debian.org/debian-security buster/updates main

/etc/apt/sources.list.d/php.list

deb https://packages.sury.org/php/ buster main

I’m not sure why the cron job does run, but Nextcloud reports that it hasn’t?

I think this started when I upgraded to 21.0.3

When I run the cron.php as www-data manually I don’t get any ouput, but Nextcloud, still doesn’t tell me that it has ran.

Not sure what is going on, would really appreciate some help with this please :slight_smile:

I have found the solution, I needed to append this at the end of the cronjob:

--define apc.enable_cli=1

With thanks too @kaliumzombie Cron is suddenly not working anymore? - #31 by kaliumzombie

This is because I have APCu enabled for memory caching.

So my cronjob is now:

*/5 * * * * www-data php -f /var/www/html/cron.php --define apc.enable_cli=1

Nextcloud Documention does mention this, actually lol: https://docs.nextcloud.com/server/21/admin_manual/configuration_server/caching_configuration.html#id1

1 Like

Also, there’s a open issue on the Git Repo: 21.0.3 OC\HintException: Memcache \OC\Memcache\APCu not available · Issue #27781 · nextcloud/server · GitHub