Fixing CRON jobs on ownCloud 10.3 Ubuntu 18.04

I upgraded to ownCloud 10.3 and found an error in my dashboard of “Last cron job execution: 5 days ago. Something seems wrong.” This was under Admin – General in the ownCloud Admin portal.

Indeed it was. Digging through the docs I could see the new command was “occ system:cron” but I couldn’t find the exact command in the docs. I poked around and was successful in running this:

Console has to be executed with the user that owns the file config/config.php
Current user: root
Owner of config.php: www-data
Try adding 'sudo -u www-data ' to the beginning of the command (without the single quotes)
root@server:~# sudo -u www-data /usr/bin/php /var/www/owncloud/occ system:cron
36 [-------->-------------------]
root@server:~#

My error went away and I now found “Last cron job execution: 6 minutes ago.” in the dashboard.

Now to add to crontab.

  1. (From console) “crontab -u www-data -e
  2. I removed my existing “* * * * * /usr/bin/php -f /var/www/cloud/cron.php” and replaced it with “* * * * * /usr/bin/php /var/www/owncloud/occ system:cron
  3. Write out and voila!
  4. Checked the ownCloud admin settings under “General” and noticed that the Cron job executed as soon as I wrote out (saved changes) to Crontab. All is well.

Leave a Reply

Your email address will not be published. Required fields are marked *

nineteen − 4 =

This site uses Akismet to reduce spam. Learn how your comment data is processed.