First, test that the script works by running it directly from your browser:
Now, you need to set up some way of running the script automatically and regularly.
On Windows systems
The simplest way is to use the little package moodle cron for windows.zip
(http://moodle.org/download/modules/moodle cron for windows.zip) which makes this
whole thing very easy by installing a small Windows service. Run it and forget about it!
On web hosting services
Your web based control panel may have a web page that allows you to set up this
cron process. For example, on a Cpanel system, look for a button called "Cron jobs".
In there you can put the same sort of Unix commands as listed below.
Using the command line on Unix
There are different command line programs you can use to call the page from the
command line. Not all of them may be available on a given server. For example, you
can use a Unix utility like wget :
wget q O /dev/null http://example.com/moodle/admin/cron.php
Note in this example that the output is thrown away (to /dev/null). The same thing
lynx dump http://example.com/moodle/admin/cron.php > /dev/null
Alternatively you could use a standalone version of PHP, compiled to be run on the
command line. The advantage with doing this is that your web server logs aren t filled
with constant requests to cron.php. The disadvantage is that you need to have access
to a command line version of php.
Using the crontab program on Unix
All that Cpanel does is provide a web interface to a Unix utility known as crontab.
If you have a command line, you can set up crontab yourself using the command:
and then adding one of the above commands like:
*/5 * * * * wget q O /dev/null http://example.com/moodle/admin/cron.php
Usually, the "crontab" command will put you into the vi editor. You enter "insert
mode" by pressing "i", then type in the line as above, then exit insert mode by
pressing ESC. You save and exit by typing ":wq", or quit without saving using
":q!" (without the quotes).