Knowledgebase

How to manage cron jobs and cron job tasks in Magento

With the help of cron jobs your Magento can perform various tasks automatically (e.g. send newsletters, update currencies, update the Google sitemap, etc.). As a matter of fact without a properly configured cron job and cron job settings these tasks cannot be performed at all.

First, you need to add a cron job that executes the cron.php file that comes with every Magento installation package. You can do this from the control panel of your hosting account or via SSH. In the Pixie control panel there's a section called Cron Jobs. Access it and click on the Add Cron Job button on the right. On the following page select from the Frequency drop-down menu how often you want the cron job to be executed. In the Command field you have to type php -f followed by the full path on your hosting account to the cron.php file. So if your application is installed directly in the public_html folder on your Magento hosting account, then the command will look like this:

php -f /home/username/public_html/cron.php

You have to replace username with the actual username.

In the admin panel of Magento there are some general settings that are connected with how the tasks executed with cron jobs are scheduled. You can configure them by going to System menu>Configuration>System button in the Advanced section on the left>Cron (Scheduled Tasks) panel on the right. Depending on how often the cron job is executed you might want to change the time for the option Missed If Not Run Within. For example, if the cron job is executed once an hour you can set it to 60 (the value is in minutes) to ensure the tasks are not missed.

Keep in mind that many of the tasks that are performed with the help of cron jobs are disabled by default. You can enable them from the respective settings in the Magento admin panel. Here is a list of some of these:

  • Newsletters - to configure and queue newsletters go to the respective section in the Newsletter menu of the admin panel.

  • Log Cleaning - you can enable the automatic cleaning of your database logs from System>Configuration>System button in the Advanced section on the left>Log Cleaning panel on the right.

  • Currency Updates - you can update the rates of currencies automatically. This can be enabled from System>Configuration>Currency Setup button in the General section on the left>Scheduled Import Settings panel on the right.

  • Product Alerts - you can enable these from System>Configuration>Catalog button in the Catalog section on the left>Product Alerts panel on the right.

  • Google Sitemap Update - to enable the automatic update of your Google sitemap go to System>Configuration>Google Sitemap button in the Catalog section on the left>Generation Settings panel on the right (a Google sitemap can be created from the top bar Catalog menu>Google Sitemap).

  • Scheduled Backups - you can enable automatic backups from System>Configuration>System button in the Advanced section on the left>Scheduled Backup Settings panel on the right.

For more details you can also read the tutorial on how to manage cron jobs in Magento.

Was this answer helpful?

 Print this Article

Also Read