If you have downloaded and installed Drupal 5, you will notice that there is an error in the administrative log when you first sign in with your administrative account.

One or more problems were detected with your Drupal installation. Check the status report for more information.

When you look at the status report you can go ahead and click the link "run cron manually" and this will remove the error. However, you will eventually want to set up a Cron job to do this. Having the Cron maintenance run regularly on an automatic schedule is important for keeping your site indexed. If this is not done, new content that is added will not be included in search results. Cron can also perform other tasks in Drupal, such as cleaning up log files. Also, some of the contributed modules require that Cron maintenance is run regularly.

With the Drupal 5 installation package, there is a script included for Cron and it is called cron.php. This file is located in the root directory of your Drupal installation. You can actually run Cron maintenance by entering, for example, the URL "http://www.yourwebsite.com/cron.php " into a web browser.

We want to get this done automatically. You can achieve this one of two ways: using the cron service on your server or use the Poor man's Cron module. If you have the cron service available on your host, this is recommended since it will run more regularly. This example will use cron and the Lynx browser. Lynx is a text browser that is often installed on servers. You will need to contact your hosting provider to make sure that they have Lynx installed (most probably do).

Once you know that Lynx is installed, you will need to find the configuration panel for setting up a Cron job in your hosting account.

The first thing to do is enter the command. The following example is the command I use to make Lynx run cron.php:

lynx -source http://www.example.com/cron.php

You may need to adjust this command depending on your hosting provider.

The next step is to decide on a schedule to have this Cron job run. Running Cron does use system resources, so you don't want to have it running every minute if you don't need to. It is up to you to decide on an appropriate schedule for having each Cron job run. Understanding the format for entering a schedule can take a little getting used to. Here is a quick rundown on scheduling options that can be entered:

Minute — any integer from 00 to 59 (specifies the minute the job will be run on)
Hour — any integer from 0 to 23 (specifies the hour the job will be run on)
Day — any integer from 1 to 31 (must be a valid day if a month is specified)
Month — any integer from 1 to 12
Weekday — any integer from 0 to 7, where 0 or 7 represents Sunday

The asterisk (*) specifies that the task should be run every time for any sub-constraint. This statement doesn't even make sense to me so let's just have a look at the examples to figure it out. You can also use the command */ to have jobs run every interval. Here the examples to help you get the hang of it.

Run cron.php task every 30 minutes:
*/30  *  *  *  *  lynx -source http://www.example.com/cron.php

Run cron.php task once a week at 1:00 am every sunday (you can see that sunday is represented by 0):
00  1  *  *  0  lynx -source http://www.example.com/cron.php

Run cron.php task on the first day of every month at 12:00 am (midnight) :
00  0  01  *  *  lynx -source http://www.example.com/cron.php

I hope this is helpful for beginners who have installed Drupal and are wondering how to setup Cron.

More information can be found under the Configuring cron jobs page in the handbooks.