How to configure a cron job in Magento 2 admin?
Magento performs some scheduled operations by running the script. You can control this Magento cron process from the admin. So how to set up a cron job in Magento 2 admin?
Step 1. Navigate to Stores > Settings > Configuration.
Step 2. Open Advanced settings > System.
Step 3. Open the Cron section.
Step 4. Complete 2 sections of the settings: Index and Default. Options will be the same for both groups:
- Generate Schedules Every - Determine the frequency of the schedule creation (in minutes)
- Schedule Ahead for - Determines how early cron jobs will be scheduled
- Missed if not Run Within - This means that if the cron job has not started after the specified time has elapsed, it will not be started and has the Missed status.
- History Cleanup Every - Defines the time for the history of ended tasks to be cleaned.
- Success History Lifetime - Sets the history lifetime for the Successful status.
- Failure History Lifetime - Sets the history lifetime for the Error status.
- Use Separate Process - Choose whether to run the separate process for all cron jobs in the group.
Step 5. Save config after completing.
If you want to configure cron jobs for Magento Commerce Cloud projects using the .magento.app.yaml file, then you have to choose between two options.
Option 1 - Self-installation
This method requires technical skills and knowledge of the code and consists of the following steps:
Step 1. Verifying cron configuration on Pro projects
Step 2. Building a cron job
Step 3. Adding custom cron jobs to your project
Option 2 - Magento configuration service
Specialists will set up cron jobs and check if it is running correctly. Moreover, with the help of the Magento configuration service, you can configure extensions for your store and configure other Magento settings affecting the work of extensions.