Search code examples
dockercronnextcloud

How to fix Nextcloud's cron job seems not to be working?


How to trigger www-data php script from cron of root user ?

After running Nextcloud from docker image cron job is not working: cron job seems not to be working

www-data user not able to start the cron job, and root user not have access to run www-data's php

Console has to be executed with the user that owns the file
config/config.php Current user id: 0

Solution

  • enter image description here

    Here is a working solution assuming you've installed cron apt-get install cron

    1. As root user run
    crontab -e
    
    1. Append this line which will run php script as www-data user
    * * * * * su www-data -s /bin/bash -c "/usr/local/bin/php /var/www/html/cron.php"
    
    1. Restart cron service
     /etc/init.d/cron restart