Get FREE $25 Hosting for Managed Magento Hosting. Use Coupon: MGT25
Avail Now

How to Setup Magento Cron Job

Magento is one of the most powerful ecommerce platforms. For example, an option in the platform allows you to set a time scheduler to run multiple activities/tasks automatically. Magento does this through Cron Job, and it also helps in increasing the performance of the Magento store. Automating tasks in Magento involves caching, indexing, generating a sitemap, auto update currency rates, and much more.

So in this tutorial, I am going to teach you how to setup cron job in Magento. If you are using Magento 2, then you can check this guide: How to Setup Cron Job in Magento 2.

Steps required to configure a cron job in Magento:

  • Create and Activate Custom Module
  • Setup Magento Cron Job

Create and Activate Custom Module

Go to the Admin Panel of your store and disable the cache by navigating to System → Cache Management.

Go to app/code/local and create directories as shown below:

directory for cron job in magento

Now you need to configure your custom module so create config.xml in app/code/local/Magenticians/Mymodule/etc and paste the following code in it:

Now that the configuration of module is done, just activate it. Create Magenticians_Mymodule in app/etc/modules and paste the following code in it:

Now, to check if the module is activated, go to System → Configuration → Advanced → Advanced, and check the list of disabled module output.

Setup Magento Cron Job

Go to app/code/local/Magenticians/Mymodule/etc and open the config.xml file. Simply update the code. The final code of config.xml will be:

In the code above, we have scheduled a cron job to run every five minutes. In <run>, I have defined a function customtask.

Now create Cron.php in app/code/local/Magenticians/Mymodule/Model and paste the following code in it:

And you’re all done! Just add this line in your crontab file:

*/5 * * * * sh /path/to/your/magento/store/

Note: Don’t forget to replace /path/to/your/magento/store with the actual path of your Magento installation.

Final Words:

Magento cron job is a great way to automate multiple tasks. After following this tutorial you should be able to setup a cron job in Magento. If you have any confusion or facing any issues about setting up Magento cron job, drop your comment below!

Frequently Asked Questions

Q1. What are the common mistakes of Magento cron job?
While setting up Magento cron job, sometimes people do following mistakes:

1. PHP Installed on other Directory
On running the following instruction for Magento Cron job you may face error as in your case PHP is installed on some other directory:
*/5 * * * * sh /path/to/your/magento/store/cron.php
To avoid this issue, run this instruction as it will search for PHP interpreter itself:
*/5 * * * * sh /path/to/your/magento/store/

2. Use Correct Email Address
Make sure you have added correct email address of both sender and receiver to setup Magento cron job:


If any error occured in the execution of Magento cron job, you will be notified via email with complete details.

Q2. Which cron script is best to run? cron.php or
This is the most very common confusion, cron.php and both scripts used for the same purpose but sometimes you can face error in running cron.php script due to the PHP installed on some different path. Whereas on running it will search PHP interpreter by itself. So its better to use rather cron.php for setting up Magento cron job.

About Author

Syed Muneeb Ul Hasan is an expert in PHP and Magento, he prefers to educate users in implementing and learning Magento. When not working, he loves to watch cricket.