Vinnie
Vinnie

Reputation: 71

Magento 1.9.1 Cron Not Running

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.

Upvotes: 7

Views: 36657

Answers (3)

ToxaBes
ToxaBes

Reputation: 1587

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.

Upvotes: 18

Maur
Maur

Reputation: 31

I just saw that you are using magento 1.9.1.

Run the cron using php instead : /usr/local/bin/php -f /home/cpanel_username/public_html/cron.php

This should resolve http permission problems you might be having when using 'usr/bin/wget -O /dev/null -o /dev/null'

Try that command and let me know if it works for you.

Upvotes: 1

Deus777
Deus777

Reputation: 1836

Well I've had a different issue. My cron was simply not working, although cron.php was executed properly. Still no output, and no jobs done.

I've checked cron_schedule and noticed that last job there is from 19th of March this year (sic!). So i kept on looking for cause.

Finally I've noticed that that there is process running with my cronjob from 19th of March (sic!).

josh 21350 99.6 0.4 350400 133492 ? R Mar19 241812:21 /usr/bin/php /var/www/mysite/cron.php -mdefault

I've killed the job with: kill -9 21350

And voila! Suddenly newsletter is being sent!

I had no idea why, and how this happened. Now i know i should pay attention to it, so I will.

Upvotes: 9

Related Questions