How to Setup a Magento Cronjob

Magento has a number of tasks such as cleaning log files that need to be run automatically to maintain a healthy/functional store. To accomplish this Magento relies on a cron job that is periodically run by the server without administrative intervention.

The Magento can be run of two ways, through the shell or by running a php file cron.php both of which are located in the root of the installation.

Setting up the Magento cronjob via shell access (SSH)

First, open the crontab

Then move to the end of the crontab (last line) and hit the return key to create a new line. Then add the correct syntax to run the or cron.php file. Below are two commands to run the cron, either as in shell or directly via the php file. Please note use only one of the following commands in the crontab.

Calling PHP file directly (Replace domain and path to Magento with your store setup):

Calling the shell script to run the cron (Replace /absolute/url/from/server/root with your server setup):

The save the crontab and exit.


Setting up the Magento cronjob via a Control Panel

In cPanel, Siteworx and most other hosting control panels there will be a cronjob manager. Select this option then use the following settings(Replace domain and path to Magento with your store setup).

Shell command:

Running PHP directly command:






Hans-Eirik Hanifl

view all posts

Hans-Eirik Hanifl is a forward thinking e-commerce and marketing consultant. As an advocate for the free exchange of knowledge, he founded E-Commerce Gorilla as a place where like-minded individuals can ask questions and share their expertise on practical solutions in the area of e-commerce and marketing. He is the owner of TRM Marketing and an avid supporter of the open source community.

0 Comments Join the Conversation →

Leave a Reply

Stay in the loop!

E-Commerce Gorilla Avatar

Join the E-Commerce Gorilla e-mail newsletter. We provide monthly updates on new articles featuring all aspects of online sales and E-Commerce setup. We cover the do's and don'ts of effective online sales, along with great giveaways. As a newsletter subscriber you are automatically entered for any competitions and giveaways.* Join our community of engaged online marketing experts, great content, and great giveaways. You can't go wrong.