How to setup Magento cronjob using ssh or Cpanel


Cron is a Linux feature that schedules tasks on your Magento hosting server (these tasks are called CronJob), these tasks can run automatically at a specified frequency. Cronjobs are useful to run certain repetitive tasks. There are many situations when a web application may need certain tasks to run periodically, for example, you can set the server to send email twice a day, or you can set server update site’s sitemap every Monday at 8 A.m…

In Magento, cron job is responsible for processing all activities to occur in the future. Below are the list of some tasks:

  • Automatic updating of currency rates
  • Update Catalog Price rules
  • Customer notification (price change…)
  • Rebuild Google Sitemaps
  • Delivering Newsletters
  • Generating database, code files backups
  • Cleaning Log

In this Magento tutorial, we will learn how to setup Magento Cronjobs using 2 method, ssh or via website’s Cpanel.

1. Setup Magento Crobjob using SSH

You can access your server’s ssh using some ssh software like Putty or bitvise

access ssh of your magento server

First check if Cronjob is setup on your server using the following command on your ssh client


crontab not installed

crontab not installed

Incase the cronjob was not set up, you will need to open crontab to manage cronjobs of your server, run the following command:

Now, go to the last line and enter the following line (remember to change and MAGENTOPATH to the URL of the root directory of your Magento installation),

It is very important that the cron.php file of Magento gets executed every five minutes. Do not change this to a longer interval.

Explanation of timing format:

timing format cronjob

Finally, save the cron tab using CTRL+X, enter y to save the changes. The following message should be displayed if cronjob is successfully saved:

Testing if Cronjob worked properly

You can use the following command to check if cronjobs are working properly

In the commands above, I put wrong command (wrong-command) and wrong file (wrong-filename.php) so if your cron job has been set up correctlythe server will return error and every five minutes you should get an email saying that there was an error with the cron script to (replace this email with your email)

2. Setup Magento Cronjob using Cpanel

If you are not familiar with SSH, you can also use Cpanel to setup cronjob for your Magento website, here’s how to do it:

First log into your Cpanel admin section and click on Cronjobs:

cpanel cronjob

Nơ you will enter a new page where you can setup and configure Cronjobs for your server.

Set how often the cronjob should be executed (every 5 minutes is recommended for Magento);

Enter file path of your Magento site to run. This will usually be:

setting up cronjob magento

After you are done, click on Add New Cron Job, now you should see your running Cronjob in Current Cronjob section


Rate this post


About Author

Daniel is a Magento developer with 5 years of experience with customizing Magento extensions, Magento templates. He's main author at Magento explorer

Leave A Reply