Knowledge Base

How to configure the Drupal cron routine

This article describes how to configure Drupal's cron routine, which performs many important maintenance-related tasks, including:

  • Indexing site content for searches.
  • Checking for system updates.
  • Maintaining Drupal logs.

Configuring the Drupal cron routine

Follow the appropriate procedure below for the Drupal version you are running.

Drupal 6

To configure the cron routine for Drupal 6, follow these steps:

  1. Log in to cPanel.
    If you do not know how to log in to your cPanel account, please see this article.
  2. In the Advanced section of the cPanel home screen, click Cron Jobs.
  3. Under Add a New Cron Job, in the Common Settings list box, select Once Per Day.
    If you have a very busy Drupal site, you might want to run the cron routine more frequently than once a day, but for the majority of web sites, once a day is sufficient.
  4. In the Command text box, type the following command. Replace username with your A2 Hosting account username:
    cd /home/username/public_html && php /home/username/public_html/cron.php >/dev/null 2>&1
    This command assumes that Drupal is installed in the public_html (document root) directory. If you installed Drupal in a subdirectory, specify that path instead.
  5. Click Add New Cron Job. Your account will now automatically run Drupal's cron routine at the specified interval.
Drupal 7

To configure the cron routine for Drupal 7, follow these steps:

  1. Log in to your Drupal site as the administrator.
  2. On the top menu bar, click Reports.
  3. Click Status report.
  4. Under Cron maintenance tasks, copy the complete URL, including http://.
    This URL includes the unique cron key for your site. You will need this URL when you configure the cron job in cPanel.
  5. On the top menu bar, click Configuration.
  6. Under SYSTEM, click Cron.
  7. In the Run cron every list box, select Never, and then click Save configuration.
    This setting disables Drupal 7's built-in automated cron feature. This feature does not actually run “real” cron jobs, but emulates them instead. Because you are setting up a genuine cron job in cPanel, you can safely disable Drupal's cron emulation feature.
  8. Log in to cPanel.
    If you do not know how to log in to your cPanel account, please see this article.
  9. In the Advanced section of the cPanel home screen, click Cron Jobs.
  10. Under Add a New Cron Job, in the Common Settings list box, select Once Per Day.
    If you have a very busy Drupal site, you might want to run the cron routine more frequently than once a day, but for the majority of web sites, once a day is sufficient.
  11. In the Command text box, type the following command. Replace URL with the URL you obtained in step 4:
    curl -s URL
  12. Click Add New Cron Job. Your account will now automatically run Drupal's cron routine at the specified interval.

More Information

For more information about cron jobs in Drupal, please visit https://www.drupal.org/cron.