Cron background job not working after update to 29

After updating from NC28 to 29, my background cron job stopped working. I can’t even change it to web or ajax because then it says “Unable to update background job mode”.

This is what’s in my cron:
*/5 * * * * sudo -u www-data /usr/bin/php /var/www/html/nextcloud/cron.php

It worked flawlesly untill the update. Anyone else having this issue or a suggestion as to where to look?

Does it work if you execute the cron.php manually from the command line?

Are there error messages appearing in the log at the times when the cronjob should be running or when you try to run it manually?

Also, it’s not a good idea to use sudo in a cronjob, as sudo would usually require you to enter your password to run the command, which could be the reason why the cronjob doesn’t work in the first place. So I would recommend to add the cronjob to the crontab of www-data and then leave out the “sudo -u www-data” part.

Edit the crontab of www-data:

crontab -u www-data -e

add the following line:

*/5 * * * * /usr/bin/php -f /var/www/html/nextcloud/cron.php 

Of course, you would then have to remove the existing job from your user’s cromtab or whatever crontab it is in now, or if it is already in the crontab of www-data, just remove the “sudo -u www-data” part.

Hi,

I edited my cron but no succes. In the logs I see:

Error
Class “OC\BackgroundJob\TimedJob” not found

I’ve found several issues on GitHub related to this message, and from what I’ve seen, I’d say this is most likely caused by some app.

https://github.com/nextcloud/server/issues/45077

https://github.com/nextcloud/richdocuments/issues/3523

So I’d first make sure all the apps are up to date, and if that doesn’t help, try disabling them one at a time. You might want to start with richdocuments, full text search and PhoneTrack if any of these are installed, as they are mentioned in the linked issues. It may also help to look at the full log message, as it may provide an indication of which app is causing the problem, and/or there may be other messages in the log that are caused by specific apps.

1 Like

Thanks!

So I checked out the full log file and found out it was the backup app that was causing problems.
I disabled it for now and cron seems to be working again!

Thanks for your help!

3 Likes

There is a error issue open at the backup app page at github.
Error in cron.php since Nextcloud Version 29
Hopefully it will be fixed soon.

1 Like

It happened to me too. Most likely because the Nextcloud Office and Collabora. I did reinstall everything but these and now it seems to be back working.

As far as I understand it, the issue is fixed in the latest versicon of the Nextcloud Office app (richdocuments), so it’s likely some other app that causes this, or something else entirely…

So should be safe installing Nextcloud Office and Collabora on version 29?

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.