Skip to main content
DrupalABC

Main navigation

  • Home
  • Search
  • Learn Drupal
  • Certifications
  • Drupal Code Finder
User account menu
  • Log in

Breadcrumb

  1. Home

How to set Drupal cron using crontab in linux environment?

It is always a nice practice to disable automated cron module and setup Drupal cron tasks from the crontab in linux and use of Drush instead of hitting a request on Drupal generated URL. Here is the way to achieve that:

1. Enter command crontab -e to open the cron tab in editor.

2. Enter the following line and save the file.

    0 */2 * * * cd /var/www/html/example-drupal && /usr/local/bin/drush cron

So this will ensure cron runs every 2 hours. Make sure to set correct Drupal directory and drush path.

Tags
Drupal8
Cron
Disqus
DrupalABC

Footer

  • Buy me a coffee
  • Drupal.org profile
  • LinkedIn
Powered by Drupal

Drupal is a registered trademark of Dries Buytaert