1

Cron has been an issue ever since 1.8/1.9 or whenever Magento made cronjobs mandatory. I've done everything I could possible do and am at my wits end. I'm seriously considering doing a fresh install of Magento and starting all over. I'm calling cron by both cron.sh and cron.php. I've modified cron.php and added $isShellDisabled = true; where it needs to be. I've installed AOE Scheduler. With that extension, I can see everything scheduled that is never executed. I checked the cron_schedule table in the database and it is constantly empty no matter what I do. I've checked with the host provider and they inform me that cron is executing properly. I've even changed the permissions of cron.php and cron.sh to 7, 5, 5.

I get these emails...

Cron error while executing core_email_queue_send_all:

exception 'Mage_Core_Exception' with message 'Too late for the schedule.' in /home/lbingman/public_html/app/Mage.php:595 Stack trace:
#0 /home/lbingman/public_html/app/code/community/Aoe/Scheduler/Model/Observer.php(47): Mage::throwException('Too late for th...')
#1 /home/lbingman/public_html/app/code/core/Mage/Core/Model/App.php(1357): Aoe_Scheduler_Model_Observer->dispatch(Object(Varien_Event_Observer))
#2 /home/lbingman/public_html/app/code/core/Mage/Core/Model/App.php(1336): Mage_Core_Model_App->_callObserverMethod(Object(Aoe_Scheduler_Model_Observer), 'dispatch', Object(Varien_Event_Observer))
#3 /home/lbingman/public_html/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('default', Array)
#4 /home/lbingman/public_html/cron.php(76): Mage::dispatchEvent('default')
#5 {main}

I'm not sure what to make of them. I've missed an order by a few days because I was never notified by email.

UPDATE: Just as I type this, I see that cron was just executed and I received a test email that I sent myself via a test order. However, the cronjob was scheduled to run at 1:38AM and I saw in AOE Scheduler that the cronjob was executed at 1:45AM. This boggles my mind because I have cronjobs on the server set to run every minute.

Just when I think I may have the problem nailed down to one area, something else happens to completely throw me off again. Does anyone have any idea what is going on? I can't believe I'm the only one having this problem.

EDIT: I should note that when I manually execute cron.php by typing in the link to it in the web browser, cron executes and all of the past unexecuted tasks show up as "Success" in the AOE Scheduler extension.

  • How often have you set the cron.php to run? – Smartie Sep 14 '15 at 7:04
  • Every minute. And I've also done every five minutes and ten minutes. – Lucas Sep 14 '15 at 11:20
  • Ok so, even though things do get skipped, you are seeing at least some of the cron jobs running? I.e. The cron you have set to run every minute is running at least 1 of the scheduled tasks but skipping the others? – Smartie Sep 14 '15 at 11:24
  • No, I am seeing none of the tasks being run. – Lucas Sep 14 '15 at 11:31
  • I should note that when I manually execute cron.php by typing in the link to it in the web browser, cron executes and all of the past unexecuted tasks show up as "Success" in the AOE Scheduler extension. – Lucas Sep 15 '15 at 3:37
4

What is your server timezone set as? And what's your Magento global config timezone?

Too late for the schedule. errors can happen because of discrepancies between these two settings.

Also check out this article: https://support.hypernode.com/knowledgebase/magento-utc-hypernode/

The timezone nut is actually not that hard to crack. But Magento has some internals that loose the sense of timezones by converting to and from an ancient time format called the Unix Time. This is a time format does not have a sense of time zones.

This problem crops up when calculating stuff involving dates and shows up as weird problems like:

  • Catalog price rules will disappear after a few hours.
  • Magento crons email your with the error “Too late for schedule”.

All of this is because MySQL and Magento do not agree on the timezone to use and also do not communicate correctly.

To solve this problem, Magento should operate on the same timezone as the server. Then, to display all dates and times on your websites and stores as you like them, set the timezone for all websites to your preferred timezone.

  • Well that definitely fixed the "too late for the schedule" issue. So at least that part is fixed. Cron still isn't working, though. – Lucas Sep 15 '15 at 4:17
2

Never the less and sorry for the incorrect comment: I solved my issue yesterday:

The problem was a magento bug and I used the following approach to solve the problem:

Open the file cron.php (back it up before editing) in the root directory of Magento and look for (around line 47): $isShellDisabled = (stripos(PHP_OS, 'win') === false) ? $isShellDisabled : true; After this line, add: $isShellDisabled = true;

Save the file.

After a couple minutes cron started working.

Hope this help guys.

1

The time zone issue between the server and Magento was definitely an issue, but I'm not sure if that's what was causing Cron to not execute.

Either way, I fixed the time zone issue so I no longer receive emails stating Too late for the schedule.

For right now, the only way I can get Cron to execute is to utilize cron.php. I know cron.sh is the better route to go, but the syntax that my hosting provider provided me with to execute cron.sh does not work. Until my hosting provider gets things figured out, I have to stick with using cron.php to execute Cron.

I believe there is something up on the server's end because I have cron.php set to execute every 5 minutes and it's actually executing every 10 minutes.

  • I should note that 'cron_schedule' in the database still shows as empty even though all of the tasks seem to be running every 10 minutes. – Lucas Sep 15 '15 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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