first up: this is my first post here so excuse me if I might do any mistakes posting this issue.
Magento (1.9.1) isn't sending any purchase mails when a customer buys something. I have done a lot of research, testing and researching again, but couldn't figure out what exacly is wrong.
my set up:
1. hoster: strato.de with Cronjob set up to every hour
2. Commandline: "/bin/php -f path/to/cron.php" this is working and I am not getting any errors from the hoster. I do get an email from the hoster every time the cronjob is started. In the mail there is no error.
3. I can also execute the same command via SSH. So there shouldn't be any error in the cron.php file in magento. I also didn't change the file.
As I mention in the headline I have installed AOE Scheduler in magento and see the scheduled tasks but all in pending and never get executed.
I also get the magento error "No heartbeat task found. Check if cron is configured correctly." which I am guessing is refering to the initial task "aoescheduler_heartbeat" which should then trigger all the other tasks like sending mails. When I manually run the heartbeat task within magento I can see in the list that the status for the aoescheduler_heartbeat goes from pending to success, but then again all the other tasks aren't executed.
It would be great if anyone has a solution I can try. Or even a work around for sending purchase mails to customers.
I just set up magento Cron error mails and this is what was sent to me from Magento:
Cron error while executing aoescheduler_heartbeat:
exception 'Mage_Core_Exception' with message 'Too late for the schedule.' in /mnt/web2/a2/53/53352553/htdocs/path/to/my/app/Mage.php:595
#0 /mnt/web2/a2/53/53352553/htdocs/path/to/my/app/code/community/Aoe/Scheduler/Model/Observer.php(47): Mage::throwException('Too late for th...')
#1 /mnt/web2/a2/53/53352553/htdocs/path/to/my/app/code/core/Mage/Core/Model/App.php(1338): Aoe_Scheduler_Model_Observer->dispatch(Object(Varien_Event_Observer))
#2 /mnt/web2/a2/53/53352553/htdocs/path/to/my/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Aoe_Scheduler_Model_Observer), 'dispatch', Object(Varien_Event_Observer))
#3 /mnt/web2/a2/53/53352553/htdocs/path/to/my/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('default', Array)
#4 /mnt/web2/a2/53/53352553/htdocs/path/to/my/cron.php(74): Mage::dispatchEvent('default')
it seems there are many people with the same problem...
Did you find a solution?
At the core, if you're getting the mesage that the heartbeat is not running, then your cron is not running correctly.
Seeing your error message makes me think that you've got the cron running at an unusual frequency - the heartbeat task looks (by default) for a cron running at least every 5 minutes, and you have an error that there basically wasn't enough time to run that task.
- what frequency are you running your Magento cron? Once every 2 minutes is fairly standard. If you run it at a longer interval, then the pending 'sub-cron tasks' (which you can see in AOE Scheduler) will pile up. Eg if you have a lot of tasks set to run every 5 minutes, and you run your cron every 15, then it will try to execute 3 of them every time it runs.
- If you run the cron direct from the command line what is the result?
You've got your cron job set to every half hour?
I'm pretty sure this is why it's failing.
Do this - In your magento admin panel, go to System => Configuration. Then go down to the Advanced => System in the left column. The first item on that page are your Cron settings.
On that page, the first item says "generate schedule for every xxx minutes" and the second is "schedule head for xxx minutes."
I've got mine to 15 & 20. So every 15 minutes, magento writes up the cron items that are going to occur in the next 20 minutes. And then based on that schedule, those jobs run when the server's cron goes through.
If your 'schedule ahead' is less than the 30 minutes that your cron runs on the server, the schedule will have expired by the time the server's cron job runs. (It won't run jobs that are too old)
Try adjusting those numbers upwards a bit to fit with your cron schedule.
Though, a previous person suggested changing your server cron task to run every five minutes. If possible, do this. Then fiddle with the config settings afterwards if you have to.
Have the same issue. One interesting note, I have 2 sites that are 188.8.131.52 (both upgrades from older versions), and one is working and the other is not.
On one site when I changed cron.sh to allow Execute (Owner) it worked, on the other it didn't.
Magento settings are exactly the same.
Just figured out the 2nd site as well.
What I did is I went under System -> Scheduler -> Scheduler Configuration and selected all tasks, then under Actions I did "Run Now". All task were finished and I am no longer getting that error message: "No heartbeat task found. Check if cron is configured correctly."
So "Run Now" helped clear all the old tasks. Keep in mind that you need to set your Hearbeat to every 5 min for Magento CE so that you do not run into:
Mage::throwException('Too late for th...')
Everyhting works fine now!
This is due to the cron_schedule table not being updated on install/upgrade simply remove the table and readd it
CREATE TABLE IF NOT EXISTS `cron_schedule` ( `schedule_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Schedule Id', `job_code` varchar(255) NOT NULL DEFAULT '0' COMMENT 'Job Code', `status` varchar(7) NOT NULL DEFAULT 'pending' COMMENT 'Status', `messages` text COMMENT 'Messages', `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Created At', `scheduled_at` timestamp NULL DEFAULT NULL COMMENT 'Scheduled At', `executed_at` timestamp NULL DEFAULT NULL COMMENT 'Executed At', `finished_at` timestamp NULL DEFAULT NULL COMMENT 'Finished At', `parameters` text COMMENT 'Serialized Parameters', `eta` timestamp NULL DEFAULT NULL COMMENT 'Estimated Time of Arrival', `host` varchar(255) DEFAULT NULL COMMENT 'Host running this job', `pid` varchar(255) DEFAULT NULL COMMENT 'Process id of this job', `progress_message` text COMMENT 'Progress message', `last_seen` timestamp NULL DEFAULT NULL COMMENT 'Last seen', `kill_request` timestamp NULL DEFAULT NULL COMMENT 'Kill Request', `scheduled_by` int(10) unsigned DEFAULT NULL COMMENT 'Scheduled by', `scheduled_reason` text COMMENT 'Scheduled Reason', PRIMARY KEY (`schedule_id`), KEY `IDX_CRON_SCHEDULE_JOB_CODE` (`job_code`), KEY `IDX_CRON_SCHEDULE_SCHEDULED_AT_STATUS` (`scheduled_at`,`status`) ) ENGINE=InnoDB AUTO_INCREMENT=1236051 DEFAULT CHARSET=utf8 COMMENT='Cron Schedule';