Frequently Asked Questions
How Do I Set Up / Create a Cron Job in Magento 2?
Here are the steps to Set Up / Create a Cron Job in Magento 2.
Step 1 - Install the Magento crontab: Log in to your server as the Magento file system owner, navigate to the project root, and run: bin/magento cron:install --force. Verify it with crontab -l.
Step 2 - Create a custom cron job (for developers): Create a crontab.xml file in your module's etc/ folder. The cron expression * * * * * means the job runs every minute; use a tool like crontab.guru to build custom expressions.
Step 3 - Define the execution class: Create a PHP class with an execute() method in your module and map it to the job defined in crontab.xml.
Step 4 - Run and verify: Clear cache and run bin/magento cron:run --group="default" from the Magento root directory to schedule and execute all jobs in the default group.
For non-developers, the Magento 2 Cron Scheduler Extension lets you create and manage cron jobs directly from the Magento admin — no command line needed.



