Magento 2 comes with many awesome features. Magento 2 Cron job is one of the most stunning features. Cron helps Magento 2 store owners to setup commands which will run systematically at a set time and date. In Magento 2, Cron job runs scheduled tasks, reindexing, generating emails, generating newsletters, sitemaps and more. Basically, the cron executes internal Magento cronjob manager and manages which cron jobs are executed and when.
Magento 2 Create Cron Job is setting an automatic schedule on time, that is really convenient when you run Magento 2 store.
how to a setup cron job
Log in to cPanel, scroll down to the Advanced section and click the Cron Jobs icon.
Scroll down to the Add New Cron Job section. You can either select from the Common Settings drop-down menus or fill out your own custom values. Fill out the form as follows:
Common Settings: This option allows you to select a preset interval for your cron job to run.
If you have not chosen one of the preset Common Settings, choose from the other options:
Minute: Either enter a custom value or select a preset value from the Common Settings menu.
Hour: Either enter a custom value or select a preset value from the Common Settings menu.
Day: Either enter a custom value or select a preset value from the Common Settings menu.
Month: Either enter a custom value or select a preset value from the Common Settings menu.
Weekday: Either enter a custom value or select a preset value from the Common Settings menu.
Enter the command you want to run in the Command field and click Add New Cron Job.
The command can be any command able to be run from the Linux terminal. This includes scripts per our bellow we wrote the sample Command Code script you can using simple by replacing your magento root Location
/usr/local/bin/php /<domain-userlocation>/bin/magento cron:run | grep -v “Ran jobs by schedule” >> /<domain-userlocation>/var/log/magento.cron.log
/usr/local/bin/php /<domain-userlocation>/update/cron.php >> /<domain-userlocation>/var/log/update.cron.log
/usr/local/bin/php /<domain-user-location>/bin/magento setup:cron:run >> /<domain-user-location>/var/log/setup.cron.log
What is a Cron Job?
A cron job is a great feature by Linux, the free operating system for the user. The cron job will create a command or a script that is appropriate with the task you want to do. Instead of manual working, the cronjob allows running automatically in exact time and date. Due to its automation, cron jobs is the perfect choice for repeated projects every date or every week.
if you need more assistance you can send us an email