Magento – Cron job script is running, but Magento order confirmation emails are not sending

cronemailmagento-1.9order-email

As the Magento documentation states, you need to set up a cron job on your web server in order to get things like order confirmation emails to send out, like so:

* * * * * /bin/sh /home/[server_username]/public_html/cron.sh

This is a very simple cron job. The issue is, automated tasks are not completing in Magento. It's as if the script isn't being run by the cron job. And as a result, order confirmation emails are not sending (among all the other Magento automated tasks).

I've installed the AOE Scheduler extension to double-check every automated task in Magento and see when tasks are completing (or, in this case, when they're not). None of the tasks including core_email_queue_send_all are completing on the 1-minute-interval basis.

Now here's the weird part. If I just go run the cron.php script (cron.sh triggers cron.php) by loading it up in my web browser at mydomain.com/cron.php, the Magento automated tasks all execute! And since the script works like this when I run it manually, and I know cron jobs are working…I can't figure this out!

Please help!


Additional Details

Here's how I know cron jobs are working—I have tested cron jobs on my server by creating a PHP script that sends a basic email with mail(), and ran a similar cron job to the one above to execute it every minute—the cron job functions normally. I am also getting MAILTO emails from the server every time the cron job runs. No errors that I can see.

I can also execute this exact command in the cron job…

/bin/sh /home/[server_username]/public_html/cron.sh

…in Terminal when I SSH in, and it runs the script successfully and Magento runs all automated tasks. It just doesn't run every minute in the cron job!

This is totally weird and I can't figure it out…. At the end of the day, all this work I did on this Magento store is moot if customer's can't check out and get confirmation emails.

Any advice would be extremely appreciated.

Best Answer

I experienced a similar issue. Check the server that runs the cronjobs for zombie magento cron processes and kill it.