Cron jobs are automated server tasks that run to a predefined schedule. They’re often used to perform administrative or background maintenance tasks that keep applications and services running smoothly.
In Drupal 8, cron jobs perform a variety of tasks, including:
- Updating the index of site content used by the Search module.
- Queuing feeds to be updated by the Aggregator module.
- Checking for available updates for the Update Manager module.
- Performing routine maintenance tasks, such as removing older rows from logs, for the System module.
When a cron job runs, it actually visits the cron.php file in your website at a URL (like http://www.mydomain.com/cron.php?cron_key=0MgWtfB33FYbbQ7YTGTL0LL3RC0PT88RFBZILLA0Nf1Re). You can find the exact address of the cron.php file in the Status report at Administration > Reports > Status report in the section Cron maintenance tasks.
Cron jobs are enabled in Drupal 8 by default, when you install the platform. Tasks can be managed in the Drupal dashboard at Configuration > System > Cron.
Cron jobs run every three hours and are triggered by a user visiting your site. You can adjust the frequency in the Drupal Cron settings page.
If you run a low traffic site, you may wish to create your own cron jobs to run at a specific interval. If you create your own cron jobs, be sure to set the automated cron settings frequency to Never, using the Run cron every dropdown menu.
Note that cron jobs only run when Drupal is processing requests and require server processing and memory resources. As a result, page loading times may increase on complex sites when cron jobs are running.
As an alternative, creating your own cron jobs on the server (for example, via My cPanel) provides more reliability and can reduce the resulting performance impact.
Be sure to disable automated cron jobs in Configuration > System > Cron, or alternatively, edit the Drupal settings.php file in cPanel File Manager.
Highlight the file and select Edit. Then add the following line:
$config['automated_cron.settings']['interval'] = 0;
If you notice any problems or if you need any help, please open a new support ticket from your HostPapa Dashboard. More details on how to open a support ticket can be found here.