Before clearing up how to run cron Job in Magento, let's get the idea of cron. Cron is a standard task planner for Unix ruled systems. You use cron job to trigger actions in 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 panel
Cron 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:
- Cron Job extension
- cron.sh or cron.php files
We choose this three variants as the simplest one and can be started even without specific coding skills.
Run Cron Job in Magento with Cron Job Extension
You can download Cron Job Runner extension. This extension allows you to trigger any cron job right from admin panel. You will see cron scheduler with all crons, their status, and periods of starts.
Starting Cron Job from cPannel
If you log into cPannel you can start cron job also. When you enter cPannel you should find Advanced setting. There is Cron Job setting button in this field.
In Cron job field you need to leave your email. You will receive emails every time cron job run. In these emails you’ll see how cron job run in your Magento store.
In cron job page in cPannel you can add new cron job and set the scheduler for cron. You choose how often cron job is to run, see the current cron jobs.
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 command
10,25,40,55 * * * * sh /www/html/magento/cron.sh
sh /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 minute
In 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 work
Note 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.
This guide will definitely help you to star cron job in Magento. If you still have some issues leave your questions in comments below. We hope, that this guide will definitely help you to get how to run cron job in Magento.