wiki:faq/cron-job

Version 8 (modified by Jamie McClelland, 3 years ago) (diff)

--

How do I add a cron job?

A cron job is a scheduled command that runs repeatedly at a given time. Often, cron jobs are set to run tasks like updating your web site statistics once an hour, or backup your data every day, or access your Drupal installation's cron.php script on a regular basis.

To set a cron job, please click on the "Scheduled Jobs" tab in the Members control panel.

You may only assign cron jobs to users that have been granted Server Access.

The crontab syntax is a series of space separated numbers or asterisks, followed by the command you want to run. For example:

5 * * * * drush --quiet --root /home/members/mayfirst/sites/mayfirst.org/web core-cron

The first five items (in this case: 5 * * * *) refers to when the cron job should be run. The columns are: minute, hour, day of month, month, day of week. An asterisk means always run. So, in the example above, it says, run at 5 minutes after the hour, every hour, every day, every month and every day of the week. Similarly, typing (5 8 * * *) would mean to run at 8:05 every day.

Everything after the numbers and asterisks is the command to be run. In this example, it means: access the http://mayfirst.org/cron.php script.