Call us now on 0115 9738074

Magento Q&A: Why are some of my scheduled tasks not executed?

Difficulty: Medium

Modification: Linux crontab

Q:

I have my scheduled tasks set up in magento and cron.php is executed periodically, however, some of the scheduled tasks are not performed. Is there anything I can do about that?

A:

We had the same problem with one of our sites. All the tasks were performed apart from sending the scheduled emails. After many discussions and when we have run out of all reasonable ideas we started looking at some more out of line ones. We noticed that the emails are sent when we access cron.php with a browser. It turns out that sometimes it is not enough to just execute your cron.php with a command line php interpretter in your linux crontab. We had to simulate a standard browser access to this php script by using wget. Here’s a sample line that you need to put in your crontab to make it work:

*/5 * * * * wget -q -O /dev/null http://.../cron.php

This line uses wget to request the cron.php file from the server and then discards the output. After putting this in place the emails were sent and they have been sending nicely ever since.

Share and Enjoy:
  • Facebook
  • Digg
  • del.icio.us
  • StumbleUpon
  • Google Bookmarks

Tags: , , ,

3 Responses to “Magento Q&A: Why are some of my scheduled tasks not executed?”

  1. [...] This post was mentioned on Twitter by Webcatch Digital, Webcatch Digital. Webcatch Digital said: Ever had problem with scheduled tasks in magento? Our latest Magento Q&A post might just help you… http://bit.ly/apOs5I [...]

  2. Great information! I’ve been looking for something like this for a while now. Thanks!

  3. reitledaliKip says:

    Just want to say what a great blog you got here!
    I’ve been around for quite a lot of time, but finally decided to show my appreciation of your work!

    Thumbs up, and keep it going!

    Cheers
    Christian

Leave a Reply