1 | .TH CRONTAB 5
|
---|
2 | .SH NAME
|
---|
3 | crontab \- table of jobs to be performed by cron
|
---|
4 | .SH SYNOPSIS
|
---|
5 | .nf
|
---|
6 | .ft B
|
---|
7 | /usr/lib/crontab
|
---|
8 | /usr/local/lib/crontab
|
---|
9 | /var/lib/crontab
|
---|
10 | /var/opt/\fIname\fP/lib/crontab\ \ \fR(Minix-vmd only)\fB
|
---|
11 | /usr/spool/crontabs/\fIuser\fP
|
---|
12 | .ft R
|
---|
13 | .fi
|
---|
14 | .SH DESCRIPTION
|
---|
15 | The
|
---|
16 | .BR cron (8)
|
---|
17 | daemon runs jobs at regular intervals. These jobs are listed in
|
---|
18 | .B crontab
|
---|
19 | files. The format of entries in a crontab file are five fields of numbers
|
---|
20 | specifying the minute (0\-59), hour (0\-23), day of the month (1\-31), month
|
---|
21 | (1\-12), and day of the week (0\-6 with 0 = Sunday) that a task must be
|
---|
22 | executed. The task to be executed follows as a shell command.
|
---|
23 | .PP
|
---|
24 | The time numbers can be given as a comma separated list of simple numbers,
|
---|
25 | ranges ("2\-5" is the same as "2,3,4,5"), and repeats ("2:5" means
|
---|
26 | "2,7,12,17,22" in the hour field). A repeat is cyclic affair, i.e. 2:5
|
---|
27 | and 12:5 are the same thing. A single "*" can be used in a field to
|
---|
28 | indicate all valid numbers in that field, so it translates to "always". In
|
---|
29 | the minute field you can use "?" for the current minute that the crontab
|
---|
30 | file is loaded. It can be used in a repeat, i.e. "?:10" for every 10
|
---|
31 | minutes. This keeps machines with identical crontabs from executing tasks
|
---|
32 | at exactly the same time, causing a burst of traffic if anything is done
|
---|
33 | over a network.
|
---|
34 | .PP
|
---|
35 | If a given time is valid in all five fields then a command is executed.
|
---|
36 | Here are a few examples that illustrate the possibilities:
|
---|
37 | .PP
|
---|
38 | .if t .RS
|
---|
39 | .if t .ft C
|
---|
40 | .nf
|
---|
41 | # min hour mday mon wday command
|
---|
42 | ? 3 * * * /usr/etc/daily # Daily system cleanup
|
---|
43 | 0 * * * * date # Print date on the hour
|
---|
44 | 30 4 * * 2\-6 /var/etc/backup # After workdays on 4:30
|
---|
45 | 0 9 25 12 * \-u ast sing # Andy sings on Xmas morning
|
---|
46 | 0 0 13 * 5 echo Beware! # For the superstitious
|
---|
47 | .fi
|
---|
48 | .if t .ft P
|
---|
49 | .if t .RE
|
---|
50 | .PP
|
---|
51 | The command may optionally be prefixed by
|
---|
52 | .BI \-u " user"
|
---|
53 | to specify under which user the command should be run. Commands from
|
---|
54 | crontabs in the spool directory are always run under the id of the crontab's
|
---|
55 | owner, the
|
---|
56 | .B \-u
|
---|
57 | flag is ignored.
|
---|
58 | .PP
|
---|
59 | A command can be placed on the same line as the time fields, or on the next
|
---|
60 | line indented by one TAB character. (A TAB, not eight spaces.) More TAB
|
---|
61 | indented lines can be added for a multiline command. The tabs are removed
|
---|
62 | from the command when passed to the shell. If a command is put on the same
|
---|
63 | line as the time fields then percent characters are changed into newlines,
|
---|
64 | this is not done for a TAB indented command. The following three entries
|
---|
65 | give the same output:
|
---|
66 | .PP
|
---|
67 | .RS
|
---|
68 | .if t .ft C
|
---|
69 | .nf
|
---|
70 | .ta +8n
|
---|
71 | 0 12 * * * echo 'Hello'; echo ' World!'
|
---|
72 | #1
|
---|
73 | 0 12 * * * echo 'Hello% World!' #2
|
---|
74 | 0 12 * * * #3
|
---|
75 | cat <<EOF #4
|
---|
76 | Hello
|
---|
77 | \& World!
|
---|
78 | EOF
|
---|
79 | .fi
|
---|
80 | .if t .ft P
|
---|
81 | .RE
|
---|
82 | .PP
|
---|
83 | Comments start with a "#" character and continue until end of line. They,
|
---|
84 | excess whitespace, and empty lines are ignored. Of the comments in the
|
---|
85 | example above #1 and #3 are ignored by
|
---|
86 | .BR cron ,
|
---|
87 | but #2 and #4 are not recognized as comments, but are seen as part of a
|
---|
88 | command and are passed to the shell who then happens to ignore them. There
|
---|
89 | is no interpretation of command characters other than the percent in a
|
---|
90 | oneliner. The time fields must all be on the same line.
|
---|
91 | .SH FILES
|
---|
92 | .TP 25n
|
---|
93 | .B /usr/lib/crontab
|
---|
94 | Main MINIX 3 crontab file.
|
---|
95 | .TP
|
---|
96 | .B /usr/local/lib/crontab
|
---|
97 | Local jobs for all systems in an organization.
|
---|
98 | .TP
|
---|
99 | .B /var/lib/crontab
|
---|
100 | System specific jobs.
|
---|
101 | .TP
|
---|
102 | .B /var/opt/\fIname\fP/lib/crontab
|
---|
103 | Per package jobs for Minix-vmd.
|
---|
104 | .TP
|
---|
105 | .B /usr/lib/packages
|
---|
106 | List of installed packages.
|
---|
107 | .TP
|
---|
108 | .B /usr/spool/crontabs/\fIuser\fP
|
---|
109 | Per user jobs.
|
---|
110 | .SH "SEE ALSO"
|
---|
111 | .BR crontab (1),
|
---|
112 | .BR cron (8).
|
---|
113 | .SH NOTES
|
---|
114 | The "?" in the minute field, the repeat field (e.g. "2:5"), TAB indented
|
---|
115 | multiline commands and the
|
---|
116 | .B \-u
|
---|
117 | option are unique to this cron implementation. This doesn't mean you
|
---|
118 | shouldn't use these features, but just that you should be aware of the
|
---|
119 | differences with other systems. You are even advised to use these features
|
---|
120 | and avoid the percent hack for multiline commands.
|
---|
121 | .PP
|
---|
122 | Other crons allow one to specify input to a job in some way, something this
|
---|
123 | cron can't. Simply use the << shell feature to do that. Other crons often
|
---|
124 | choke on empty lines.
|
---|
125 | .PP
|
---|
126 | It is a common bug to use 0 for Sunday instead of 7. This cron, like most
|
---|
127 | other crons out there accepts this without comment.
|
---|
128 | .PP
|
---|
129 | A job is not reissued until a previous instance of it has exited. The next
|
---|
130 | time to execute is computed from the previous time it ran. If job issuing
|
---|
131 | lags behind on the system time then the next time to run it is computed from
|
---|
132 | the current system time.
|
---|
133 | .SH AUTHOR
|
---|
134 | Kees J. Bot (kjb@cs.vu.nl)
|
---|
135 |
|
---|
136 | .\"
|
---|
137 | .\" $PchId: crontab.5,v 1.3 2000/07/17 18:53:05 philip Exp $
|
---|