Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento 1.7 - Cron.php: too late for the schedule

Tags:

cron

magento

I created some modules to be executed by magento cron but i get always the error. The numbers:

  • Cron.php gets executed every 5 minutes
  • system/cron/schedule_generate_every = 15
  • system/cron/schedule_ahead_for = 30
  • system/cron/schedule_lifetime = 15

The module cronjobs should be executed every 5 minutes. They are added correct to cron_schedule to be executed i.e. at 2014-01-16 16:40:00, 2014-01-16 16:45:00, 2014-01-16 16:50:00 ... But on execution in 16:50 i get lots of errors. exception 'Mage_Core_Exception' with message 'Too late for the schedule.' also for jobs in the future.

Perhaps: our local time is 17:50, server time 16:50. But i can't remember we had this issue before on other cronjobs.

like image 303
s4lfish Avatar asked Jan 16 '14 17:01

s4lfish


1 Answers

If the cronjob runs every 5 minutes, try this configuration:

Generate Schedules Every  5 

(enter here the cronjob execution time, in this case 5 minutes)

Schedule Ahead for  125 

(based on cronjob execution time plus the maximum time one job needs. For example: sitemap generation takes 120 minutes, then enter 120 minutes + 5 = 125 minutes)

Missed if Not Run Within  180

(runtime of the longest process, for example: an import takes 120 minutes, then enter 120 minutes + 60 minutes - because sometimes there is a difference between mysql and server time)

History Cleanup Every  10 

(minimum cronjob execution time = 5 * 2 = 10 minutes in this case)

Success History Lifetime  1440 

(duration of cronjob storage, to proof if everything works fine. 1440 = 24 hours)

Failure History Lifetime  1440

(duration of cronjob storage, to proof if there is an error. 1440 = 24 hours)

And last but not least, install AOE-Scheduler for a visual inspection of your cronjobs.

http://www.magentocommerce.com/magento-connect/aoe-scheduler.html

like image 151
Miss Magenta Avatar answered Dec 02 '22 23:12

Miss Magenta