Understanding Magento Cron Jobs

by | Aug 30, 2011 | Insights | 1 comment

Apparently many Magneto developers are a bit confused about how Magento cron jobs work. It’s easy to know why. In the Magento backend, there’s a Cron configuration screen where you can set the frequency at which cron schedules are to be processed, under System > Configuration > System.

Cron Scheduled Tasks Screenshot

Cron Scheduled Tasks Admin Panel

Many are under the impression that configuring this screen will automatically trigger the various periodic cron jobs relating to Magento, such as re-indexing and Google Base feeds and sitemaps. This screen merely instructs Magento on how to manage cron schedules.

Cron is a scheduler program built into unix-based operating systems. Cron jobs are driven by a file called a crontab.

Unfortunately, it’s not quite as simple. Your server has to know to run these cron jobs. Fortunately, if your hosting provider provides you with cPanel access, triggering cron jobs is quite easy. A convenient cPanel tool helps you easily create a crontab.

  1. Log into your cPanel account.
  2. Go to Advanced > Cron Jobs. You should see a panel that look like this:
    Cron Job cPanel
  3. To trigger your Magento cron jobs every 15 minutes, enter the following:
    • Minute: */15
    • Hour: *
    • Day: *
    • Month: *
    • Weekday: *
    • Command: [path from root]/cron.sh
  4. For Command, your path from root might be something like /home/account_name/public_html. If you’re unsure, use the cPanel File Manager to see what the path is from your account root to your Magento installation.
  5. Click Add New Cron Job.
  6. For verification, under Cron Email,  enter your email address and you will receive a brief email each time the cron job runs showing you if the cron ran successfully or not. This won’t tell you if the Magento jobs were successful, only that the server cron routine ran. Once you know your schedule is running correctly, delete your email address from this entry (otherwise, you’ll continue getting email every 15 minutes, 24 hours a day).

There are further configurations you can make in Magento regarding the individual cron routines, but for many, just knowing how to trigger the cron jobs goes a very long way toward resolving an often asked problem.

Bret Williams

Bret is the a co-founder and the Managing Partner of novusweb®. He is also author of several books on Magento and e-commerce and is sought as a speaker and trainer. Bret has been crafting internet innovations since 1995.

    1 Comment

    Leave a Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.


    Past Articles

    Some links in this site include affiliate codes that will commission us for any business you do with the destination business.

    %d bloggers like this: