Thursday, September 13, 2012

Drupal Cron Failed To Run Solved

Drupal Cron should run everyday and I was doing some maintenance in one Drupal site when the message "cron failed to run" appeared and here is how I've solve it:

Delete cron variables from the database

DELETE FROM variable WHERE name="cron_semaphore";
DELETE FROM variable WHERE name="cron_last";

Empty cache

Empty cache from /admin/settings/performance and Flush all caches from the administration menu

Optimize all tables

Go to phpmyadmin and check all the tables in your database, select Optimize tables and execute it, wait till is over.
Optimize table is something you should do every now and then to keep the database healthy, it helps to rebuild all the indexes of the Myisam tables.

Then launch cron: cron run successfully.


Anonymous said...

thank you
my cron is ok now

Maria M. Olivares said...

I'm glad it helped you :)

Anonymous said...

Nice one.

Its working for me...

Anonymous said...

I also had to clean my search_index table because it was huge (uninstall and install search module)

and clean boost cache.

And then it worked, thank you!

Maria M. Olivares said...

I'm glas it helped you! Some times Drupal tables need some maintenance and cleanup, like optimizing them

drupal said...

cron run failed in drupal 7.22 & drupal 7.23

Anonymous said...

Thanks, it solved my Cron problem :)

Anonymous said...

i dont have "cron_semaphore"

and still field :(

Maria M. Olivares said...

did you solve it?
In Extreme cases you can disable the semaphore entirely:
in drupal_cron_run()
//$semaphore = variable_get('cron_semaphore', FALSE);
$semaphore = FALSE;

but watch out with this, make a copy of the file first, check and correct errors and then restore the original file

Anonymous said...

1st off all find file on include folder than i edit it like this but its not working

Maria M. Olivares said...

I see you have another problem,mmm.. One solution could be:

Make a copy of your site and data base and install it in your computer, on a local Apache serve, then edit the file settings.php and add these lines at the top:

ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

Next run cron from your computer like this:
Open your browser and go http://mylocalhost/cron.php

All errors should be printed on the screen now

Anonymous said...

Thank you so much!

Post a Comment

Your opinion is very appreciated, thank you!