It was not possible to execute the cron job via CLI

Nextcloud version (eg, 18.0.2): 20.0.4
Operating system and version (eg, Ubuntu 20.04): Docker Image
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.38
PHP version (eg, 7.1): 7.4.13

The issue you are facing:

Cron job is not running (properly)?!

The following error is shown:

  • It was not possible to execute the cron job via CLI. The following technical errors have appeared:
    • Your data directory is invalid Ensure there is a file called “.ocdata” in the root of the data directory.
  • Last background job execution ran 23 hours ago. Something seems wrong. Check the background job settings

Is this the first time you’ve seen this error? (Y/N): N

I tried/checked/verified the following:

  • The datadirectoryas well as the .ocdata file are accessible by the www-data user. The above mentioned error that there is no “.ocdata” is complete nonsense. It is also possible to browse the files in the NC UI.
  • I am using external SMB storages and I assume that this is somehow related, but I haven’t seen any errors that would point me into the right direction.
  • I did run a occ files:scan --all - no errors were shown but the issue is still there.
  • I cannot change the background job setting from “Cron” to “Ajax” or “Webcron”, neither via the GUI nor via occ (even after renaming /cron.sh and .../cron.php (as suggested somewhere else).
  • I executed php -f cron.php (as www-data) manually, it returned quite immediately - no error or any output whatsoever.
  • I tried to mount the data directory under /var/www/oc_data (as suggested here: [solved] Trying to restore nextcloud, Your data directory is invalid - #2 by iGormilhit) but still no luck…

I’m really running out of ideas how to further troubleshoot this issue. :frowning:

I have encountered the same error message in the admin settings… (currently on NC 21.0.2)

my data dir is there, as well as the .ocdata file, there is no problem whatsoever, but that message stays there…

have you been able to resolve this?

Yes. Check out this link- Allowed memory size of xxx bytes exhausted in current latest-container · Issue #1413 · nextcloud/docker · GitHub