How to Set Up a Cron Job in Magento

In order for your Magento to function properly, you need to set up a Magento Cron Job in your cron tab. There are two ways to set up Cron Job.

Configuring Magento Cron Job using Command Line

Step 1. Connect to Magento server using SSH

Connect to the 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.

Step 2. Open the cron tab editor

Once you’ve connected to the Magento server – please execute the following command in order to edit cron tab.

crontab -e

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

Step 3. Copy the code to set up a cron job

Add the following lines of the code to set up the cron jobs:

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.

Save your changes after you finish editing the file.

Configuring Magento Cron Job using 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 the execution of the following script 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 the following error message shown on the extension configuration page, like it is shown on the screenshot below.

After you set up 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:

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.

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:

About The Author: Anastasiia Yaremchuk

Deeply passionate about making a good copy. Now exploring new horizons of SEO and content marketing. Apart from the digital world, she is obsessed with travelling, films and caffeine. View more posts