How to setup cron in Magento 2

- Magento 2

Magento 2 Development

To execute the Magento 2 cron job, use the following code:

If you want to automate the process, add it to /etc/crontab. For instance:

More tips from Magento 2 Developer’s Cookbook


If you are looking for a tool that allows leveraging crone in import of export processes, check our Magento 2 Improved Import Export module. It adds cron jobs for both processes, and you can use either predefined configuration, or create your own schedule. For further information, follow this link:

Download / Buy Firebear Improved Import / Export Magento 2 Extension