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:
- Log in to cPanel.
If you do not know how to log in to your cPanel account, please see
this article.
- In the Advanced section of the cPanel home screen, click Cron Jobs.
- 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.
- In the Command text box, type the following command:
cd ${HOME}/public_html && php ${HOME}/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.
- 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:
- Log in to your Drupal site as the administrator.
- On the top menu bar, click Reports.
- Click Status report.
- 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.
- On the top menu bar, click Configuration.
- Under SYSTEM, click Cron.
- 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.
- Log in to cPanel.
If you do not know how to log in to your cPanel account, please see
this article.
- In the Advanced section of the cPanel home screen, click Cron Jobs.
- 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.
- In the Command text box, type the following command. Replace URL with the URL you obtained in step 4:
curl -s URL
- Click Add New Cron Job. Your account will now automatically run Drupal's cron routine at the specified interval.
For more information about cron jobs in Drupal, please visit https://www.drupal.org/cron.