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 asmemory_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...