I need to use cron for my Nextcloud setup, but I’m having trouble getting it right.
I’d like to not use the host’s crontab, but unfortunately it’s currently the only thing that works reliable. Other solutions like posted here don’t work:
nextcloud-cron | su: must be run from a terminal nextcloud-cron | Sat Jan 26 11:46:05 UTC 2019 - Running cron finished
I’ve tried a different approach from another file I’ve found, but that too doesn’t work:
cron: image: nextcloud:15-apache container_name: nextcloud-cron restart: always networks: - backend user: www-data depends_on: - postgres volumes: - nextcloud-data:/var/www/html entrypoint: | bash -c 'bash -s <<EOF trap "break;exit" SIGHUP SIGINT SIGTERM while [ ! -f /var/www/html/config/config.php ]; do sleep 1 done while true; do echo "Running cron…" php -f /var/www/html/cron.php echo "Done." sleep 15m done EOF'
nextcloud-cron | Running cron…
Which never finishes
Any suggestion on how to fix it? Or alternative solutions? I’d really like to have a solution that I can implement through a docker-compose file.
Edit: I forgot, executing the cron.php from host works fine with the following line:
docker exec --user www-data nextcloud php cron.php