Cron is suddenly not working anymore?

Hi,

i recognized, that cron is suddenly not working anymore.
I have the following entry in “sudo crontab -u www-data -e”:

*/15 * * * * php -f /var/www/nextcloud/cron.php

Service cron status is showing me “active” and the path to cron.php is correct.
Maybe something happend during trying to install php 7.4? But now PHP 7.2. is running again and i removed PHP 7.4.

In the syslog i can see these entries:

Mar 10 09:00:01 wolke-NUC CRON[8661]: (www-data) CMD (php -f /var/www/nextcloud/cron.php)
Mar 10 09:00:01 wolke-NUC CRON[8659]: (CRON) info (No MTA installed, discarding output)

Ubuntu 18.04.
NC 18.0.1
PHP 7.2.24

Can you change it in:

*/15 * * * * php -f /var/www/nextcloud/occ system:cron

It is not working, i tried both. I can see in the log cron has done the job ? but nextcloud is telling me, that it has not worked:

Mar 10 09:20:01 wolke-NUC CRON[9855]: (www-data) CMD (php -f /var/www/nextcloud/cron.php)
Mar 10 09:20:01 wolke-NUC CRON[9856]: (www-data) CMD (php -f /var/www/nextcloud/occ system:cron)
Mar 10 09:20:01 wolke-NUC CRON[9846]: (CRON) info (No MTA installed, discarding output)

What is the setting of you cron in the settings?

is your emailsetup working correctly?

I am not sure if you mean this settings?

m h dom mon dow user command

17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

No, i don’t use this. So the error is fine. Or could it help my at finding the issue?

cron complains that there is no MTA (message transfer agent) set - so it could help, maybe

Can you put this on the end of youre cron:
>> /dev/null 2>&1

Not working

errors in crontab file, can’t install.

Do you put this at the start: >>

Yes, sure!
Would it be possible, to do a clean reinstall from cron? Maybe this “repairs” the issue?

Try to do your crontab command “php -f /var/www/nextcloud/cron.php” in a terminal. Probably it will tell you, that it is trying to use a php-version which isn’t to be found.

If i do that, i get now answer - the terminal is jumping in the next line and waiting for a new command.

But it seems not to work:

The full command is:

sudo -u www-data php -f /var/www/nextcloud/cron.php

Yes, but it is not working. :confused:

And if you do something like

sudo -u www-data php -f /var/www/nextcloud/cron.php 1,2>/home/YOURHOMEDIR/cronphp.txt

is there some output in cronphp.txt ?

Also, ich werde jetzt etwas weiter ausholen. Ich habe eine ähnliche Konfiguration mit Ubuntu 18.04.4, NC16.0.9 und PHP7.3.
Wenn ich den crontab-Eintrag im Terminal ausführe dann wird bei mir das bei den Grundeinstellungen->Hintergrundauftrag auch sofort angezeigt.
Ich hatte versuchsweise mal PHP7.4 installiert, und diese Installation dann nicht vollständig rückgängig gemacht. Danach bekam ich die gleiche Meldung in Grundeinstellungen->Hintergrundauftrag wie Du. Als ich dann den crontab-Eintrag im Terminal ausführte bekam ich dann aber einen Hinweis direkt im Terminal, daß versucht wird mit einem nicht vorhandenen PHP 7.4 zu arbeiten.
Das alles scheint bei Dir nicht der Fall zu sein. Kann es sein, daß Du zwei NC-Installationen hast und Dir dabei etwas durcheinander geraten ist?

Danke für deine Bemühungen!

Also ich bin mir ziemlich sicher, dass es was mit PHP zu tun hat. Weil, sofern ich es vorher nicht übersehen habe, ist der Fehler bei mir auch erst aufgetreten, nachdem ich PHP 7.4. versucht habe zu installieren. Ich hab danach PHP7.4. mit purge wieder entfernt und 7.2. in apache wieder aktiviert.
Ich hab keine 2 NC Installationen … ich hab am Server nur ein NC und eine Collabora (mittels Docker).

Gibt es noch ein Log File, welches mir ev. helfen könnte?

Danke und Lg!

Was sagt ein “php -v” direkt in der Konsole aus?

Auch könntest du schauen, wie lange die cron.php läuft wenn du diese manuell aufrufst?

*/15 * * * * php -f /var/www/nextcloud/cron.php

Bei einigen Kunden, die sehr große NC Instanzen haben, läuft der Cron länger als 15 Minuten sodass die Ausführung angepasst werden muss solange der Cron läuft.