Magento 1.9.1 Cron Not Running

Vinnie picture Vinnie · Apr 20, 2015 · Viewed 34.5k times · Source

I am having big issues with the cron of Magento 1.9.1 hoping someone can help. I have AOE installed and see not heartbeat.

I have added my cron job

*/5 * * * * /bin/sh /var/sites/p/domain/public_html/cron.sh

But this still does not run, so I decided to try and try and run cron.php, this does nothing. This is my cron for this

*/5 * * * */usr/bin/wget -O /dev/null -o /dev/null http://www.domain.com/cron.php

Based on Magneto 1.8 cron.php I added the following to the cron.php.

$isShellDisabled = true;

Based on this still not working I tried the cron.php in the browser. I get an error in the browser that Printing is disabled by default for security reasons.

So I changed my php.ini to memory_limit = 512M just incase. This is still not working.

The error I get in my reports for this is:

 a:5:{i:0;s:59:"Mage registry key "_singleton/cron/observer" already exists";i:1;s:537:"#0 /var/sites/p/domain.co.uk/public_html/app/Mage.php(223): Mage::throwException('Mage registry k...')
#1 /var/sites/p/domain.co.uk/public_html/app/Mage.php(477): Mage::register('_singleton/cron...', false)
#2 /var/sites/p/domain.co.uk/public_html/app/code/core/Mage/Core/Model/App.php(1316): Mage::getSingleton('cron/observer')
#3 /var/sites/p/domain.co.uk/public_html/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('default', Array)
#4 /var/sites/p/domain.co.uk/public_html/cron.php(74): Mage::dispatchEvent('default')
#5 {main}";s:3:"url";s:9:"/cron.php";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:5:"admin";}

Any help would be really great.

Note ** I have change the domain name to DOMAIN due to my site not being suitable for work.

Answer

ToxaBes picture ToxaBes · Apr 20, 2015

Few simple steps to fix Magento cron issue:

  1. Go to System > Configuration > Advanced > System > Cron (Scheduled Tasks) and set next values:

    • Generate Schedules Every: 15
    • Schedule Ahead for: 20
    • Missed if Not Run Within: 15
    • History Cleanup Every: 10
    • Success History Lifetime: 60
    • Failure History Lifetime: 600
  2. Clear Cache in System > Cache Management

  3. Clear 'cron_schedule' table. You can do it via phpmyadmin or execute next command in SQL console:

    TRUNCATE TABLE cron_schedule;

  4. Add next line to cron settings (use absolute paths):

    */5 * * * * /usr/bin/php /absolute/path/on/your/server/to/file/cron.php

Note: in some configurations on webserver (apache/nginx) allowed to execute php scripts. In this case add this line to webserver's user crontab. Example for apache: crontab -u apache -e

  1. Restart cron daemon.

  2. Check table 'cron_schedule', if it's not empty - Magento cron script start working.