X hide

How to setup a Cron Job in Magento

From Plumrocket Documentation

In order for your Magento to function properly, you need to setup a Magento Cron Job in your cron tab.

There are two ways to set up Cron Job.

Configuring Cron Job with the help of Command Line

1. Connect to Magento server using SSH. Read more detailed information on how to connect to your server using SSH, if you use Windows OS or MAC OS or Linux OS
2. Once you've connected to Magento server - please execute the following command in order to edit cron tab.

crontab -e

Magento cron job in magento 1.jpg


After this command has been performed - the cron tab editor will open.


Magento cron job in magento 2.jpg


Add the following line:

0,5,10,15,20,25,30,35,40,45,50,55 * * * * /bin/sh /absolute/path/to/magento/cron.sh

where absolute/path/to/magento/ - is the path to the specific folder of your Magento installation.


Magento cron job in magento 3.jpg


Save your changes after you finish editing the file.


Configuring Cron Job with the help of Hosting Panel

In order to configure Cron Job, you can also use your Hosting Panel. Almost all hosting providers offer a panel where you can set up Cron Job for Magento. Please, follow the instructions below to configure Cron Job for Magento correctly.

1. Log into your hosting panel and in the Cron Job settings section, set up execution of the following script to every 5 minutes:

/bin/sh /absolute/path/to/magento/cron.sh

2. For more information on how to set up Cron Job in cPanel read this article. In order to set up Cron Job with the Nexcess hosting - please read here.


Magento cron checker script

In terms of Plumrocket Magento extensions - if the Cron Job settings were configured incorrectly, there will be a following error message shown on the extension configuration page, like it is shown on the below s—Āreenshot.


Magento cron job missing crontab.png


After you setup Cron Job properly, this message will disappear (sometimes it might take up to 30 minutes). Note that this message will not be removed instantly, since the tasks are being executed within the set periodicity.


Also you can use the special script in order to check the proper functioning of Cron Job tasks and its settings. In order to check the status of the cron by the means of the script - please follow the steps below.

1. Download the magento-cron-checker.zip archive and unzip it.
2. Upload it to the root directory of the site as shown below:


Description.png Detailed description:
  1. This is your client side. You will see the script file.
  2. This is your root directory on server side. This is where the file should be uploaded.
  3. All the files must be uploaded to the server. Select the file and press the right mouse button
  4. Select the "Upload" option in order to upload the file to the server.


Magento-cron-check-script.png


3. Now enter the script path in your browser's address bar and follow this address. The path format is:

 www.yourdomain.com/magento-cron-checker.php

where "yourdomain" is the name of your domain.

The screenshot below displays the page that will appear after you successfully run the script:


Description.png Detailed description:
  1. Enter the path to execute the cron checker script in you browser's address bar.
  2. Successful message page.


Magento-cron-check-script-1.png



Navigation