Cron for Drupal
Understanding how Pantheon cron execution and cron management works on your Drupal site.
Cron is a time-based task scheduler that can be configured to automatically execute tasks without any manual involvement beyond the initial configuration.
Cron will always run unless all jobs are specifically set to 'Off' via Elysia or Ultimate Cron modules. Cron will also not run via Drush if a cron key is set with Elysia.
Both Drupal core and many contributed modules have tasks that need to be performed on a regular basis. You can configure when and how often cron executes the tasks.
Containers on Pantheon are automatically spun down following a period of inactivity, then spun back up once a web request is made. Cron is not run on idle containers that have been spun down. For details, see All About Application Containers.
Pantheon Cron Execution
Pantheon executes cron once an hour on every environment to allow Drupal to perform scheduled tasks. This generally occurs within 5 to 10 minutes of half past each hour: 4:30pm, 5:30pm, 6:30pm, etc.
Typically cron is triggered via a browser/page request or crontab. However, Pantheon uses the following to automatically trigger cron on the platform:
drush pantheon_cron 3600
Technically, the command bootstraps your site and invokes drupal_cron_run, similar to how Drupal cron runs normally.
You can manage cron via Drupal's admin interface at
There are a couple of ways to interact with cron on Pantheon. One way is to execute cron manually from the Drupal admin interface.
Click Run cron to run all scheduled tasks. Alternatively, you can run all scheduled cron tasks with the following Terminus command:
terminus drush <site>.<env> -- cron
To ensure that cron tasks have been run, check the reports via the Drupal Admin interface at Reports > Recent Log Messages. If cron has run recently, entries will appear in the log. The two entries in the screenshot below show that cron has run and a cron task called "cron_example".
Run Cron More Often
While Pantheon doesn't provide a mechanism for custom scheduling of cron tasks, the platform will automatically execute
drush pantheon_cron 3600 once an hour, usually within 5 to 10 minutes of half past each hour (4:30pm, 5:30pm, 6:30pm, etc).
If the site has not been accessed through the web by a visitor for at least two hours, the platform suspends the associated services until it's accessed again and cron will not run.
There are several workarounds. Most work by keeping the site awake, then using a different mechanism for executing cron tasks.
To keep the site active, some users have used Pingdom to automate access to their site as often as once a minute. In conjunction, the use of the Drupal module Elysia Cron allows for granular control over cron scheduling and execution with both a user interface and API.
By having Pingdom visit the site once a minute like a visitor, the site stays active and Elysia Cron has an opportunity to act every minute (if it needs to). This combination is not officially supported by Pantheon, but has worked for some of our customers.
A single-part solution is to set up New Relic's Synthetics Ping Monitoring to hit Cron URLs. You may still want to use Elysia Cron to schedule different cron tasks at different frequencies though. One advantage of this approach is that your site may already have a New Relic instance associated with it, saving you from having to setup another third-party service.
If you have anything that is executing cron tasks on your own server, you can invoke Drush commands remotely using Terminus, including Drush cron, to trigger scheduled operations.
Another very effective solution is to leverage a service such as EasyCron. You can set custom schedules, notifications, and logging through their web interface or through their EasyCron Module. The unique URL to kick off cron externally can be found at
To disable Drupal's standard cron:
- Navigate to Configuration > System > Cron within the admin interface.
- Select Never from the "Run cron every" drop-down menu.
Click save configuration:
This configuration disables cron execution in Drupal, but it does not affect Pantheon's cron execution at the platform level which runs every hour on all environments.
Drupal 7 sites using the Elysia Cron contrib module to extend the standard cron can globally disable it in the module's settings:
Why didn't cron run?
The most common causes are:
- Missing sites/default/settings.php
- PHP fatal errors
- Invalid redirection logic in settings.php
- Setting a cron key in Elysia Cron's settings:
What is the maximum execution time of cron?
The maximum execution time of cron is 180 seconds (3 minutes).
How can I find out when cron last ran?
You can check the log messages through the Drupal Admin interface.
You can also use Terminus to see when cron was last run with the following command:
terminus drush <site>.<env> -- wd-show --type='cron'