Configuring the Drupal cron routine
Drupal includes a cron routine that performs essential maintenance tasks automatically. On ruachost.com, you can configure cron to run at regular intervals to keep your site healthy and optimized.
Why Use Cron in Drupal?
Section titled “Why Use Cron in Drupal?”- Indexes site content for searches.
- Checks for system and module updates.
- Cleans up logs and temporary files.
- Ensures scheduled tasks run reliably.
Steps to Configure Cron
Section titled “Steps to Configure Cron”For Drupal 6
Section titled “For Drupal 6”-
Log in to your cPanel account.
-
In the Advanced section, click Cron Jobs.
-
Under Add a New Cron Job, select Once Per Day from the common settings.
-
In the Command box, enter:
Terminal window cd ${HOME}/public_html && php ${HOME}/public_html/cron.php >/dev/null 2>&1(Adjust the path if Drupal is installed in a subdirectory.)
-
Click Add New Cron Job. ✅ Your account will now automatically run Drupal’s cron routine daily.
For Drupal 7
Section titled “For Drupal 7”-
Log in to your Drupal site as an administrator.
-
Go to Reports → Status report.
-
Copy the Cron maintenance tasks URL (includes a unique cron key).
-
Go to Configuration → System → Cron.
-
Set Run cron every to Never and save. (This disables Drupal’s built‑in cron emulation.)
-
Log in to cPanel.
-
In Advanced → Cron Jobs, select Once Per Day.
-
In the Command box, enter:
Terminal window curl -s https://example.com/cron.php?cron_key=YOUR_UNIQUE_KEY(Replace with the URL copied in step 3.)
-
Click Add New Cron Job. ✅ Your account will now run Drupal’s cron routine daily.
For Drupal 8 and 9
Section titled “For Drupal 8 and 9”- Cron can be configured directly in the Drupal admin interface under Configuration → System → Cron.
- Alternatively, you can set up a cPanel cron job to trigger the cron URL at regular intervals for more reliability.
Important Notes
Section titled “Important Notes”- For busy sites, consider running cron more frequently (e.g., every 6 hours).
- Always back up your site before making configuration changes.
- Cron jobs are essential for keeping Drupal secure and optimized.