Nextcloud Cron Jobs
To run scheduled tasks inside a nextcloud docker container use the docker-host system crontab of the root user.
Note: running a cron docker container as non-root user is too complicated for this setup.
A few notes:
- Run official docker images. Not needed with AIO
- The user running nextcloud is 1001.
- The main docker folder is at /home/user/docker
- The project folder name is nextcloud.
Run in terminal (docker host system terminal):
# i am not root - use sudo
[sudo] crontab -e
# scroll down to the last line and add
*/15 * * * * docker compose -f /home/user/docker/nextcloud/compose.yml exec -u 1001 --env HOME=/tmp nextcloud php /var/www/html/cron.php
This will run the tasks every 15 minutes.
Quick tip: Use Crontab Guru to verify cron schedules syntax.
