Setting up localhost cron jobs


Your Drupal website needs to perform certain self-maintenance tasks (also called cron jobs) on a regular basis. These tasks can include exchanging information and heartbeat signals with Acquia Insight, removing expired session information, and updating database tables and the search index, depending on your website's exact configuration.

The internal service that Drupal uses to perform these maintenance tasks is cron.

Using cron with Drupal

Managing cron in Drupal is dependent on your installed Drupal version.

Using cron with Drupal 7 or 8

To manage your Drupal-based website's cron settings, use the Cron page at Configuration > System > Cron (http://[site_URL]/admin/config/system/cron). This page allows you to run cron immediately or to have it run based on a regular schedule.

You can also call cron from outside your site, by using the unique URL at Reports > Status report (admin/reports/status) in the section Cron maintenance tasks.

Using cron with Drupal 6

Drupal 6-based websites can't start their own cron jobs. Websites need an outside service to visit the URL http://[site_URL]/cron.php at regular intervals to initiate these maintenance tasks. For live, production websites, there are various third-party cron services available.

If you've installed Drupal onto your computer (localhost) or another IP address not accessible from the public Internet, you'll need to configure cron jobs to run from your own computer.

Crontab on Mac, Linux, and Unix

With Mac, Linux and Unix servers, you manage cron using a crontab that executes cron jobs at specified intervals.

Crontab syntax

A crontab consists of five placeholders or numbers and a command to be executed. The numbers indicate how often it should run:

* * * * * [command]

The five asterisks represent the Cron time string that the cron uses to determine the schedule to execute [command]. For more information about the Cron time string, including how to format the string to create time intervals, see Cron time string format.


The following example configures the crontab to run a cron job every five minutes, with the task of visiting /cron.php.

  1. Open the terminal window on your computer.
  2. Using the which or whereis commands, determine if the following applications exist on your computer, and where they're located:
    • curl
    • wget
    • lynx

    For example, to use whereis to find the location of the curl command (or to even determine if it's installed on this computer), use the following command:

    whereis curl

    If the command you're looking for exists on your computer, the whereis (or which) command returns a directory path similar to the following:


    Be sure to note the location of the command, because you'll need to know its location later in this procedure.

  3. If curl, wget, and lynx aren't installed on your computer, you'll need to install one of these free applications. Search online for one of these applications, as well as installation instructions for your operating system.
  4. In the terminal window, enter the following command to edit your crontab:

    crontab -e
  5. Using the application present on your computer, set only one of the following crontabs, substituting the correct path for your system to the program and the correct path to your localhost Drupal installation:
    • lynx

      */5 * * * * /usr/bin/lynx -source http://localhost/cron.php
    • wget

      */5 * * * * /usr/bin/wget -O - -q -t 1 http://localhost/cron.php
    • curl

      */5 * * * * /usr/bin/curl --silent --compressed http://localhost/cron.php

To confirm that the crontab is working, set your scheduled task to run at five minute intervals, and then examine the Recent log entries page of your localhost installation at Administer > Reports > Recent log entries (http://[site_URL]/admin/reports/dblog) after 10 to 15 minutes. If you see Cron run completed. entries in the report at the expected intervals, your crontab is running successfully.

For more information about configuring cron jobs, see Configuring cron jobs at

Cron on Windows

In Windows, use Scheduled Tasks or Task Scheduler to run cron.php at regular intervals for your website.

Create your new scheduled task based on the following items:

  • For the scheduled task's command to run, enter the path and filename for your installed web browser, followed by the address of your localhost website's cron.php in double quotation marks. For example, if you installed Acquia Drupal using the Acquia Dev Desktop and its standard ports, the address would be "http://localhost:8082/acquia-drupal/cron.php."
  • As you develop or test Drupal on your computer, you'll probably want to run Cron more than once a day.
  • If you configure the cron task to run after relatively long intervals, you can set the start time to a minute later than the current time to be able to check right away that it is working correctly.

To confirm that the cron task is working, set your scheduled task to run at five-minute intervals, and if you are using dblog, examine the Recent log entries page of your localhost installation at Administer > Reports > Recent log entries (http://[site_URL]/admin/reports/dblog) after 10 to 15 minutes. If you see Cron run completed. entries in the report at the expected intervals, your cron task is running successfully. If you are not using dblog, examine Cron maintenance tasks at Reports > Status report and look to see that it has a value of less than 5 minutes after 10 to 15 minutes.

For information about how to create scheduled tasks in Windows, see the Help file for your installed version of Windows.

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
By submitting this form, you accept the Mollom privacy policy.

Contact supportStill need assistance? Contact Acquia Support