Managing cron intervals in Drupal 8
A cron job is a script that is set to run at a particular time or interval. Drupal8 has a cron that can run and perform various things regarding your Drupal 8 installation. These include checking for updates for the core and modules as well as maintenance tasks such as clearing logs.
By default, the cron task is set to not run, but you can certainly set it to run either at a scheduled time or even run it manually whenever you wish. The cron can be resource intensive on the webserver so it is not a good idea to run it too often. Below are the instructions on how to set your cron intervals as well as run the cron manually, if needed.
In this tutorial:
How to run Cron jobs in Drupal 8
Setting the cron interval
- Log into your administration dashboard.
- Click the Menu tab option from the upper menu bar.
- Next, click on the Configuration tab from the second menu bar.
- This brings up the Configuration screen. From here, find the Systems category and click on the Cron option.
- From the Cron page, locate the Cron Frequency dropdown and select your desired interval. It is recommended not to use a frequency of less than 12 hours as the cron can cause higher resource usage on your server as it runs. Limiting this to once or twice a day maximum will help maintain optimum server health.
- Once you have selected your interval, click on the Save button to finish up. Your cron will now run on the selected interval.
Running the cron manually
- Log into the admin interface.
- Using the upper menu bar, click on the Menu option, then click on the Configuration option from the secondary menu bar.
- You are brought to the Configuration screen. Look for the Systems category and then click on the Cron option.
- Now that you are on the Cron page, simply select the Run Cron button to run the cron function manually.