Configure Cron Job in cPanel for Drupal Site

Drupal contains a file cron.php, which is responsible for handling maintenance tasks as cleaning up the log files, checking for updates, indexing for the search module, etc. The cron.php file is automatically installed during/with the drupal installation and simply loading the following URL will run the cron file for maintenance, etc.

For example, to run the cron.php file of my drupal site, I just load the URL:

For regular maintenance of the site, the cron.php file has to be called, either manually through the URL or automatically/periodically by setting up a cron job. In cPanel, “cron jobs” can be accessed in the Advanced tab.

A cron job can be added in the cron job page through the “Add New Cron Job” tab.

The “Common Settings” drop down contains various options as “Every Minute”, “Every 5 Minutes”, “Every Day”, etc. You can select any one of the default options provided the cron job to be called or run. Also, one can use custom settings provided in the Minute, Hour, Day, Month or Weekday drop down menus provided to run the cron daemon as required by the user.

In the “Command” input we enter the URL to the cron.php file as below:

wget >/dev/null

Pressing the “Add New Cron Job” button adds the cron job to run the specified command and “pings” the url which equivalents to loading the url in the address bar of the browser.

One can add any number of cron jobs in the cPanel interface. The cron jobs added in the cPanel are shown in the “Current Cron Jobs” tab in the cron jobs page of cPanel.

My cron job command is

0 11 * * 1 wget >/dev/null

which “pings” the url “wget” once a week on Monday (weekday -> 1) at 11 AM (Hour -> 11).

Add a Comment

Your email address will not be published. Required fields are marked *