Book Image

Drush for Developers - Second Edition

By : Juan Pablo Novillo Requena, Juan P Novillo Requena
Book Image

Drush for Developers - Second Edition

By: Juan Pablo Novillo Requena, Juan P Novillo Requena

Overview of this book

Table of Contents (13 chapters)
Drush for Developers Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
2
Keeping Database Configuration and Code Together
Index

Running periodic tasks with cron


The first place to go to set up periodic tasks is Drupal's cron (https://www.drupal.org/cron). Cron is a built-in tool that runs periodically to perform tasks such as clearing caches, checking for updates, or indexing content subject to be searched. Modules can implement hook_cron() (https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_cron/7) in order to have their tasks executed via cron.

Drupal's default behavior is to run cron automatically every three hours. It can also be triggered manually through the administration interface or using Drush. Running cron with Drush is desirable for the following reasons:

  • Drush runs using a different PHP.ini configuration than the web server that does not have a request timeout. Furthermore, other PHP variables such as memory_limit can be adjusted to higher values, if needed.

  • Cron's output can be logged in to a file and monitored, so actions can be taken if there is an error.

  • Drush can easily...