Helping ordinary people create extraordinary websites!
HOME TUTORIALS SCRIPTS WEB HOSTING BLOG FORUM
Get Our Newsletter
Email:

Cron

By Will Bontrager
2004-01-09


Hypothetical Situations

For purposes of explaining each field, let's use three hypothetical situations.

1. A script must run one minute before the end of
every year.

2. A script must run at 2:20 every Tuesday morning.

3. A script must run every 15 minutes from 9 in the
morning to 9 in the evening. And it must run every
30 minutes the rest of the time. (Note, this
requires two schedule lines.)


The Minute Field

The minute is the first field. The values examples of range, list, and step, above, illuminate the versatility built into the system.

For each of the three hypothetical situations, the minute field would be:

1. 59

2. 20

3a. */15

3b. */30


The Hour Field

The hour is the second field. The allowed values are the same as the minute field, 0-59.

For each of the three hypothetical situations, the hour field would be:

1. 23

2. 2

3a. 9-21

3b. 0-8,22-23


The Day Of the Month Field

The day of the month is the third field. The allowed values are 1 through 31.

For each of the three hypothetical situations, the day of month field would be:

1. 31

2. *

3a. *

3b. *


The Month Field

The month is the fourth field. The allowed values are 1 through 12.

Instead of digits, 3-letter abbreviations may be used:

1 2 3 4 5 6 7 8 9 10 11 12
jan feb mar apr may jun jul aug sep oct nov dec

For each of the three hypothetical situations, the month field would be:

1. 12

2. *

3a. *

3b. *


The Day Of the Week Field

The day of the week is the fifth field. The allowed values are 0 through 7.

Digits 1 through 6 represent Monday through Saturday, respectively. On some systems, 0 represents Sunday and on others 7 represents Sunday. On a few systems, both 0 and 7 represent Sunday. Your hosting company can tell you which applies to your server. Or, you may wish to try 0 and see if the script runs on Sunday. If it doesn't, try 7.

Instead of digits, 3-letter abbreviations may be used:

0 1 2 3 4 5 6 7
sun mon tue wed thu fri sat sun

For each of the three hypothetical situations, the day of week field would be:

1. *

2. 2

3a. *

3b. *


Tutorial Pages:
» Cron
» The Cron Table
» The Five Schedule Time Fields
» Hypothetical Situations
» The Hypothetical Situations Schedules
» The Sixth Field, The Command
» On-line Documentation for cron and crontab
» A Practice Script
» Conclusion


Copyright 2004 Bontrager Connection, LLC


 | Bookmark
Related Tutorials:
» How to Install PHP 5 on Linux
» How to Install Apache 2 on Linux
» How to Install MySQL 5.0 on Linux
» SMB Caching
» Mound --Bind
» Tar Wild Card Interpretation

Ask A Question
characters left.