How to Set Cron in Magento 2
Magento 2 facilitates the feature of cron job that allows to schedule activities ahead of time and thus automates them, saving our time! Some of the examples where an admin needs to set Cron in Magento 2 are reindexing, generating Google sitemaps, customer notifications, updating currency rates, etc.
Get rid of doing important periodic tasks manually. Automate such tasks in your stores by configuring cron job in Magento 2.
There are two methods to set cron in Magento 2:
- From SSH
Open SSH as root user and type crontab -e and add the below commands. - From cPanel
Cron can be set directly from cPanel by adding the below commands.
Add the Following Commands to Set Cron in Magento 2:
1 2 3 |
* * * * * /usr/bin/php /var/www/magento2/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/magento2/var/log/magento.cron.log * * * * * /usr/bin/php /var/www/magento2/update/cron.php >> /var/www/magento2/var/log/update.cron.log * * * * * /usr/bin/php /var/www/magento2/bin/magento setup:cron:run >> /var/www/magento2/var/log/setup.cron.log |
You may review the post or ask any doubts in the comments section below. Hit the 5 stars to appreciate our efforts.
Thank You!
Sanjay Jethva
Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe.
His passion for Magento 2 and Shopify solutions has made him a trusted source for businesses seeking to optimize their online stores. He loves sharing technical solutions related to Magento 2 & Shopify.
Prev
How to Create New Admin User in Magento 2
How to Override Product View Page Social Meta Tags in Magento 2
Next