Magento Tip: Setting Up Cron (Scheduled Tasks)

Magento has it’s own cron (scheduled tasks) system which handles such things as newsletter sends, sitemap generation and database log cleaning. To activate this system, you need to set up a cron job on the server to run Magento’s cron script at a regular interval.

Magento provides a shell script (cron.sh) which calls a PHP script (cron.php)
Both files are in the root directory of the Magento installation.
I like to bypass the shell script and run the PHP script directly, and I set it to run every 5 mins

To do this in Debian, you should open your crontab for editing:

crontab -e

Then add a crontab entry such as this (replacing with your path):

*/5 * * * * php -q /path/to/magento/cron.php

The default cron scheduling settings work fine for me but you can tweak them if you like to have more control:

System > Configuration > Advanced > System > Cron (Scheduled Tasks)

Note: A quick way to test your setup is to check the database table called cron_schedule. If cron is running, this table will have records in it. Remember to wait 5 mins after adding the crontab entry so it has a chance to run :)

One Response to “Magento Tip: Setting Up Cron (Scheduled Tasks)”

  1. I also used you way of direct execution from cron.php. Now I will configure the Log-cleaning ;)

Leave a Reply