10

My Magento cron works normally about a few months ago. But recently, it suddenly stop generating schedule. The cron command itself running fine in my hosting server. It is Magento ver 1.8.0.0.

These are what I have tried:

  1. I try executing cron.php in the browser, and it doesn't generate schedule in cron_schedule table.

  2. Install AOE Scheduler extension, hoping it can solved the problem. I can generate schedule using this extension, but Magento cron cannot execute the cron schedule.

  3. Install fresh Magento ver 1.8.0.0 in hosting server, and then executing cron.php in the browser, cron_schedule table still empty.

  4. Install fresh Magento ver 1.8.0.0 in my localhost, and then executing cron.php in the browser, it generates schedule. So I try to upload it to the hosting server. I clear Magento cache, then executing cron.php in the browser, surprisingly nothing happen in cron_schedule table. But it works fine in my localhost.

I have another Magento site ver 1.7.0.2 in the same hosting server, the cron is working fine.

I still don't know what the cause of this problem, so I post it here. Hoping that somebody have the same problem, and share the solution.

  • 2
    I ran into a similar issue several months ago. The command line php interpreter had a separate php.ini configuration and the memory_limit was set too low so the cron jobs would fail. Not sure if this is your issue. – Fiasco Labs Nov 18 '13 at 6:56
  • The memory_limit is 256M and this is the command I use /usr/bin/wget http://www.mysite.com/cron.php >/dev/null 2>&1. – Wakanina Nov 18 '13 at 7:10
24

I found the solution in the forums (link not online anymore)

Previously I tried to install Magento 1.7.0.2 in my hosting server, and the cron is running fine. So I assumed my hosting cannot run Magento 1.8.0.0 cron so I was planned to downgrade my Magento site to 1.7.0.2. But before I downgrade my site, I found the solution on the link above.

  • Edit file cron.php
  • After $isShellDisabled = (stripos(PHP_OS, ‘win’) === false) ? $isShellDisabled : true; around #47 add this line of code

    $isShellDisabled = true;

And now My Magento 1.8.0.0 cron run perfectly.

  • In my case, I am working on a server that has given me nothing but headaches due to ambiguous configuration. This was the only way I could get cron to run. – pspahn Jan 5 '15 at 19:12
  • Its working for wget, but better change name to eq cron89128923489.php ;) – user956584 Mar 3 '15 at 13:16
  • This worked for me too. Probably something to do with shell access restrictions. – Daniel West Jun 3 '15 at 13:42
  • Link has MageBayVaporated... – Fiasco Labs Mar 15 '16 at 4:37
  • I explained why this workaround works and what the real solution is here: magento.stackexchange.com/questions/137130/… – Fabian Schmengler Oct 24 '16 at 19:06
11

The solution given by Wakanina worked for me. However, changing the file cron.php was sort of unacceptable in our policy. Strange thing is that I've deployed my site on two servers(with same OS, PHP version) and on one server it executes cron tasks when cron.php is executed and on other server nothing happens.

So had to try a better solution which will keep my site upgrade proof.

Instead of executing cron.php, I am now executing cron.sh through crontab -e since Linux is used as server OS.

  • 2
    This is how it should be done. – Robbie Averill Oct 9 '15 at 4:57
2

The issue is magento_root/cron.php was not set in server crontab. We need to add this file in crontab so it worked for us as follow.

# crontab -l (this command will list all the Cron jobs in Crontab)

There should be an entry for magento_root/cron.php file. If not, we need to add this file because this file is responsible for initiating your Magento Cron jobs. So we need to edit the Crontab as follow.

# crontab -e

Add the following statement in the file and close after saving it.

*/5 * * * * wget -O /dev/null -q path_to_magento_root/cron.php > /dev/null

For more information, visit this link

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.