6

We are using AOE cron scheduler from Fabrizio Branca. My scheduled tasks are loading, cron working fine etc. When I look at the timeline or list view, the jobs are loading successfully. But all of a sudden we are seeing the error message:

Last heartbeat is older than 37 minutes for example.

So the heartbeat scheduled task is not running at all currently. Any ideas how to begin debugging to try to work out the cause? I have looked at the log files which are giving no clues. I can manually run the task, but that is obviously not a solution. Any advice or ideas would be appreciated. Thanks.

1 Answer 1

11

This is probably one of the following two problems.

Your cron isn't being called properly

Often the cron.php just isn't called right. Either your cron.php isn't called at all or maybe it's called with insufficient rights or resources to execute properly. For example, executing the cron like this:

*/5 * * * * php -f /home/user/domain/public_html/cron.php

Might get very different results than expected because the user doesn't have the same rights as the user that runs the web server. And the PHP CLI has a different php.ini which may not have sufficiently large memory or execution time limits.

I often solve this by using wget or curl to call my cron or by editing the php.ini file that is used by my PHP CLI.

Magento is missing jobs

This happens if the settings under System > Configuration > System > Cron (Scheduled Tasks) are not configured corectly. This results in cron jobs being missed, even though the cron.php is called correctly. Make sure schedules are created and they schedule far enough ahead. And the "Missed if Not Run Within" is large enough.

3
  • 1
    Hi Len, thanks for your help. The cause for us was 1 of our developers changed the cron.php file in the root and didn't log it!!! We added the old file back in and hey presto it worked again. We were looking for a complicated answer when it was really quite simple... Your answer above is great and will be relevant for others.
    – MagentoMac
    Nov 28, 2013 at 15:38
  • 1
    In my case I needed to add the full path to php (/usr/bin/php) to get it work! Oct 8, 2014 at 22:37
  • If you have ssh access, at the command line, run which php to get the full command execute path to the CLI php executable so you are using the right one to run cron.php. Also, the user that it's being executed under is dependent on whether your crontab is set via editing /etc/crontab or from a cPanel function. The /etc/crontab entry will need to include the user that the web server is being run as, in the above crontab entry line. Jan 18, 2016 at 0:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.