Getting cron working in Nextcloud

I am getting the error: Last background job execution ran 2 hours ago. Something seems wrong. using cron as the background jobs setting.

Doing some research it seems using the system cron is the best option.

I was going to add the line docker exec -u www-data nextcloud php cron.php but testing it I get the error unable to find user www-data: no matching entries in passwd file

so which user should I use? Or am I using the wrong approach all together?


I tried --user nginx and --user cron and got permission denied: unknown

Everything in the container is running as user abc
With that said, we don’t support running manual commands inside the container unless we ask you to do so

You can define a crontab from any users on your host.

crontab -e

In the editor, add :

*/5  *  *  *  * docker exec -i nextcloud sudo -u abc php -f /config/www/nextcloud/cron.php

Thanks for this advice. I was following documentation from Nextcloud which was suggesting to run with a different command.

I have been able to update my crontab simply using crontab -e but I have a question: where can I find a cron log file to see if my commands are being executed? Is it up to me to pipe the output to my own log file as part of the crontab?

Many thanks in advance.

Apologies for bringing an old thread back to life - I can’t seem to create a new discussion here yet, presumably because my account has just been created.