11 Jun 2013

Inside Magento Cron Jobs

Magento CronMagento cron jobs are an often overlooked, yet essential feature of a smooth running magento shop front.

Cron jobs are essentially a scheduled task. The default magento cron triggers a number of important functions including:

  • Database log cleanups
  • Newsletter queue runs
  • Catalog pricing rules
  • Sitemap generation
  • Customer notifications
  • Currency updates

Developers also often hook into the magento cron run, for integration with 3rd party extensions.

Failing to correctly setup the cron job for magento can lead to operation issues for store owners and have a negative impact on the overall performance of the shopping cart.

Magento Pro TIP: A magento website database will continue to grow to levels that will effect web hosting performance. Triggering the cron database clean-up function will regularly clean and optimise the database.

Activating the magento cron job

The magento cron job is normally triggered through a cron tab as part of your web hosting account.

Most cpanel web hosting plans include a utility to control the frequency of the cron job; its safe to set the cron job to every 10 minutes (just don’t go to low)

The default magento cron job will trigger the file “cron.php”, located in the root directory of your magento install.

cPanel Magento Cron

This sample magento cron is set to run every 10 minutes every day, ensure the command path is updated to the correct location of your magento cron.php

cpanel magento cron

Sample Magento Cron (cpanel)

Configuring the magento cron

You can configure various aspects of the default magento cron by navigating to the cron settings page.

Admin > System > Configuration > System > Cron

Magento Cron Job Config

Magento Cron Job Config

Magento Crons Wrapped Up

Ensure you include creating and configuring your magento cron job in your pre launch check list to get the most from your magento web site.

More information about the inner workings and developing for the magento cron can be found in the official magento knowledge base.

OE provide a range of magento web hosting plans that allow complete control of magento cron runs.