Owncloud cron does not update news feeds

Posted by brendon on 13 September 2015 - 2:24pm

Sometimes you'll find that cron stops working and all your News goes stale. Here's a solution.

I use a cron job to update my News feeds. This can be added in the following manner:

sudo crontab -u www-data -e

Now add a line to the crontab:

*/15 *  *  *  * php -f /var/www/owncloud/cron.php > /dev/null 2>&1

Owncloud creates a lock file when the cron.php job is executing which will prevent further instances of cron.php. Unfortunately though you can get into situations where the cron.lock file prevents cron from executing - a dead lock situation: 

sudo -u www-data php -f /var/www/owncloud/cron.php

will give: 

Another instance of cron.php is still running!

The solution is to simply remove the lock file: 

sudo rm /var/www/owncloud/data/cron.lock

Some bright sparks have created an additional cron job to check for the lock file and delete it if is older than 30 minutes:

* * * * * find /var/www/owncloud/data/cron.lock -cmin +30 -delete

Links:

http://doc.owncloud.org/server/7.0/admin_manual/configuration/background_jobs.html#cron

https://github.com/owncloud/core/issues/3221

Tags: