March 13, 2024

How to Run Cron Job in Magento?

NEKLO Team

Magento (Adobe Commerce)

NEKLO Team

Magento (Adobe Commerce)

Before clearing up how to run Cron Job in Magento, let’s get the idea of corn. Cron is a standard task planner for Unix ruled systems. You use a cron job to trigger actions at a predetermined time without the presence of admins. For example, if you need to update currency rate every hour.

What Processes Can be Started by Cron in Magento?

In fact you can trigger any process by cron. But If you use out of box magento there is a few cron job you can config in admin panelCron Job in Magento

  • Clean the system of temporary waste
  • Sending newsletters
  • Updating site map
  • Notify customers about new items
  • Updating currency settings
  • Recalculation of price rules

3 easy Ways How to Run Cron Job In Magento

There are three main ways to trigger cron job:

We choose these three variants as the simplest ones and can be started even without specific coding skills.

1) Run Cron Job in Magento with Cron Job Extension

You can download the Cron Job Runner extension. This extension allows you to trigger any cron job right from the admin panel. You will see a cron scheduler with all crons, their status, and periods of starts.

2) Starting Cron Job from cPannel

If you log into cPannel you can start a cron job also. When you enter cPannel you should find the Advanced setting. There is a Cron Job setting button in this field.In the Cron job field, you need to leave your email. You will receive emails every time the cron job runs. In these emails, you’ll see how cron job run in your Magento store.

On the cron job page in cPannel, you can add a new cron job and set the scheduler for cron. You choose how often cron job is to run, see the current cron jobs.

3) How to run Cron Job in Magento using file cron.sh or cron.php

There are cron.sh and cron.php scripts in the folder where your Magento located.In crontab you should write the next command10,25,40,55 * * * * sh /www/html/magento/cron.shsh /www/html/magento/cron.sh is the root folder your Magento installation.10,25,40,55 * * * * means that cron will start in 10, 25, 40 and 55 minute every hour.If you use use command */5 * * * * sh /www/html/magento/cron.sh cron will star every 5 minuteIn cron command you see five stars (*). Each star mean the period. In the table below you can see the stars meaning.

There are five stars in command. Each means a period of time in which cron should workNote that when we use the exact time for the cron, then * is not needed, if we set the launch period, then the * must be left.

In conclusion

This guide will definitely help you to start a cron job in Magento. If you still have some issues leave your questions in the comments below. We hope, that this guide will definitely help you to get how to run a cron job in Magento.