Understanding Magento Cron Jobs

Cron-Schedule-2.png

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.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:

  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.

Previous
Previous

What is Driving Online Retail Sales?

Next
Next

How to Spread Your Message