As it was explained above, the configuration files used to control the operation of cron are called crontab files or cron tables.
They are text files which direct the cron daemon's activity. Blank lines and those whose first non-blank character is # will be ignored.
The entries in one crontab file are lines of six fields each.
The fields are separated by spaces or tabs.
The lines have the following format:
|
|
|
|
minute hour monthday month weekday command
|
|
|
|
|
The first five are integer patterns that specify when the sixth field (command) should be executed. They have the following ranges of values:
field |
description |
value |
minute |
The minute of the hour |
0-59 |
hour |
The hour of the day |
0-23 |
month day |
The day of the month |
1-31 |
month |
The month of the year |
1-12 |
weekday |
The day of the week |
0-6 (0=Sunday) |
The first five fields can also use any one of the following formats:
- an asterisk character (*) to match all values
- single integer that matches that exact value
- comma separated list of integers, like 1,3,5 to match one of the listed values
- a range of integers separated by a dash, like 4-6, to match the values within the range
Note that the specification of days can be made in two fields: month day and weekday. In both are specified in an entry, they are cumulative. For example:
- runs
command at midnight on the 1st and 15th of each month, as well as every Monday.
To specify days in only one field, set the other field to asterisk (*). For example:
- runs
command only on Mondays.
The sixth field, command (the balance of a line including blanks in a crontab file),
is a string that is executes by the shell at the specified times.
Actually it is specifies the absolute path that represents a specific batch file which start the execution of processing
one or more interfaces in both directions.
For example:
25 |
2 |
* |
* |
* |
/opt/integrationlayer/bin/as400filereceiver.ksh WarrantyCreditsIMPHDL |
- this entry specifies that the batch as400filereceiver.ksh which start the execution of processing
WarrantyCreditsIMPHDL interface will be run at 2:25 on every day of every month.
See this example with one simple crontab file.