Webcron / Background Jobs are not running but cron.php success


hopefully I am right here. I am running a qnap as a NAS and found a docker compose file that I used to create a docker container behind a reverse proxy. Everything is working so far and it feels really good. The only thing nagging me is the fact that background jobs are not executed (at least that is what my NC is telling me).

Nextcloud version: 21.0.0 (docker)
Latest Nginx (docker)
Php 7.4

I am executing every 15 minutes my cron.php via a webcron service that also sends me an e-mail and I get always the same message:
Status: 200

I the Nextcloud Backend it shows that some Background Tasks have not been running since 4 days. Is there a possibility to start Background-tasts manually or check which of the background-tasks has not been running?

I tried to check the Console and log files but I only see some error that do not appear to be involved with backgrund-tasks.

Maybe you can point me in the right direction where I need to have a look. Thanks a lot!

[no app in context] Error: Error: Call to a member function getContainer() on null at <>

The output of your Nextcloud log in Admin > Logging:

[no app in context] Error: Error: Call to a member function getContainer() on null at <<closure>>

0. /var/www/html/lib/private/AppFramework/Bootstrap/Coordinator.php line 143
   OC\AppFramework\Bootstrap\RegistrationContext->delegateContainerRegistrations({admin_audit: OC ... }})
1. /var/www/html/lib/private/AppFramework/Bootstrap/Coordinator.php line 86
2. /var/www/html/lib/private/Installer.php line 146
3. /var/www/html/apps/settings/lib/Controller/AppSettingsController.php line 448
4. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 218
   OCA\Settings\Controller\AppSettingsController->enableApps(["admin_audit"], [])
5. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 127
   OC\AppFramework\Http\Dispatcher->executeController(OCA\Settings\Con ... {}, "enableApps")
6. /var/www/html/lib/private/AppFramework/App.php line 157
   OC\AppFramework\Http\Dispatcher->dispatch(OCA\Settings\Con ... {}, "enableApps")
7. /var/www/html/lib/private/Route/Router.php line 302
   OC\AppFramework\App::main("OCA\\Settings\\ ... r", "enableApps", OC\AppFramework\ ... {}, {_route: "settin ... "})
8. /var/www/html/lib/base.php line 993
9. /var/www/html/index.php line 37

POST /settings/apps/enable
from by Hartmut at 2021-04-08T13:25:45+00:00

Hey @hartworx

You could use crontab on your QNAP machine to execute cronjobs (Add items to crontab - QNAPedia)

Here is also an official documentation from Nextcloud about the background jobs / cron in particular (Background jobs — Nextcloud latest Administration Manual latest documentation) - Cronjobs need to run every 5 minutes.

As you mentioned Docker, the command to execute the cron.php from your Nextcloud installation in crontab, could look something like this:

*/5 * * * * /bin/docker exec --user {webserver_user} {docker_container_name} php /path/to/the/cron.php

The required information can be found, by accessing the docker container via SSH - To access the container, you can use the following command:

$ docker exec -ti {nextcloud_container_name} bash

Thanks a lot for pointing me in the right direction.
For my configuration I had to create a cron entry this way:
*/5 * * * * /share/CACHEDEV1_DATA/.qpkg/container-station/bin/docker exec -u www-data nextcloud-app php -d memory_limit=-1 /var/www/html/cron.php

It works <3 Thank you @CFelix

You are welcome, glad it works now :slight_smile:

Hi all,

I’m also facing this issue but on a regular host (not in docker).
Http is returing 302 to login page, but nextcloud is not recognizing it’s being called.

Any other ideas to get webcron working without switching to cron?

Thanks in advance,