Extra Block Types (EBT) - New Layout Builder experience❗

Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.

Demo EBT modules Download EBT modules

❗Extra Paragraph Types (EPT) - New Paragraphs experience

Extra Paragraph Types (EPT) - analogical paragraph based set of modules.

Demo EPT modules Download EPT modules

Scroll
15/04/2025, by Ivan

Setting up cron is an important step in building a website and helps maintain site resources for search indexing, checking for core and module updates, and clearing temporary files.

A properly configured cron job manages many tasks:

  • Updates the site content index used by the Search module.
  • Feeds queues to be updated by the Aggregator module.
  • Checks for available updates using the Update Manager module.
  • Performs routine maintenance tasks such as clearing old log entries, handled by the System module.

What is cron?

Cron is a daemon that executes commands at specified intervals. These commands are called “cron jobs.” Cron is available on Unix, Linux, and Mac servers. Windows servers use Scheduled Tasks to execute commands. A cron job is a time-triggered action typically (and most efficiently) executed by your hosting server but can also be triggered by a remote server or even your local machine.

What happens is that the cron job visits the cron.php file on your site, such as http://www.example.com/cron.php?cron_key=0MgWtfB33FYbbQ5UAC3L0LL3RC0PT3RNUBZILLA0Nf1Re. The exact URL for cron.php can be found in the Status Report under Administration > Reports > Status Report (admin/reports/status) in the Cron Maintenance Tasks section.

Enabling cron

The easiest way is to let Drupal handle this for you (which it does by default) using the built-in "Automated Cron" system. You can manage Automated Cron under Manage > Configuration > System > Cron (admin/config/system/cron). The default frequency is every three hours. After that, cron will run during a user request no more frequently than once every three hours. Note that for low-traffic sites, it might still be beneficial to create a cron job. To disable Automated Cron, set “Run cron every” to “Never.”

The automated cron system is compatible with all environments because it doesn't use the system's cron daemon. Instead, Drupal checks at the end of each request when cron last ran and, if it has been too long, executes cron tasks as part of the request. There are two downsides: (1) cron tasks only run when Drupal handles a request; and (2) the resource load of running cron is added to a user request, potentially slowing it down or exceeding memory limits on complex sites.

The second method (applicable to any Drupal version) is to create a cron job or use another external method to run cron, such as a third-party cron service like EasyCron or Cronless. This method is more reliable (as it always runs on schedule) and uses fewer resources (since cron processing is not added to a page request). It’s generally the preferred way to run cron when possible. Note that if you set up an external cron job, you can completely disable Drupal’s built-in cron system.

Disabling Automated Cron

For performance reasons or if you want cron to run only from an external trigger, you may wish to disable the automated cron system.

You can do this by setting “Run cron every” to “Never” in Administration > Configuration > System > Cron (admin/config/system/cron).

Another way to disable cron in Drupal 8 is to add the following line to your settings.php file:

$config['automated_cron.settings']['interval'] = 0;

This effectively sets admin/config/system/cron to “Never” and prevents it from being overridden by admin users.

Drupal’s online documentation is © 2000-2020 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.