Commit | Line | Data |
---|---|---|
227e8768 KB |
1 | .\" Copyright (c) 1991, 1993 |
2 | .\" The Regents of the University of California. All rights reserved. | |
c033ce0f CL |
3 | .\" |
4 | .\" %sccs.include.redist.roff% | |
5 | .\" | |
3dd13888 | 6 | .\" @(#)crontab.5 8.3 (Berkeley) %G% |
c033ce0f CL |
7 | .\" |
8 | .Dd | |
3dd13888 | 9 | .Dt CRONTAB 5 |
c033ce0f CL |
10 | .Os |
11 | .Sh NAME | |
12 | .Nm crontab | |
13 | .Nd chronological services schedule file | |
14 | .Sh SYNOPSIS | |
15 | .Nm crontab | |
16 | .Sh DESCRIPTION | |
17 | The | |
18 | .Nm crontab | |
96d06c26 | 19 | file contains the schedules used by the |
c033ce0f CL |
20 | .Xr cron 8 |
21 | daemon. | |
22 | Each line in the schedule gives a time of execution | |
23 | and the command to be executed. | |
24 | .Pp | |
25 | A line consists of | |
26 | two fields giving the time, | |
27 | three fields giving the day, | |
28 | a user name field, | |
29 | and lastly the command to be | |
30 | executed. | |
31 | The first five fields are space | |
32 | or tab | |
33 | separated and may | |
34 | consist of a number, | |
35 | a comma separated list of numbers, | |
36 | or an asterisk meaning any or all possible values. | |
37 | The last field (the command field) may contain spaces. | |
38 | A field containing two hyphen separated numbers is treated as | |
39 | an inclusive range. | |
40 | .Pp | |
41 | The fields are: | |
42 | .Bl -enum -offset indent | |
43 | .It | |
44 | The minute of the hour, a number from 0 to 59. | |
45 | .It | |
46 | The hour, a number from 0 to 23. | |
47 | .It | |
48 | The day in terms of the month, a number from 1 to 31. | |
49 | .It | |
96d06c26 | 50 | The month in terms of the year, a number from 1 to 12. |
c033ce0f CL |
51 | .It |
52 | The day in terms of the week, a number from 1 to 7. | |
53 | Monday is considered day one, Sunday is day seven. | |
54 | .It | |
55 | The name of a user: the command will be run with the | |
56 | user's uid and permissions. | |
57 | .It | |
58 | The command to execute. This field may be terminated with a | |
96d06c26 | 59 | newline or the |
c033ce0f CL |
60 | .Ql % |
61 | character. | |
62 | .El | |
63 | .Pp | |
64 | An optional file | |
65 | .Nm crontab.local | |
96d06c26 | 66 | may be created and used for additional scheduling. |
c033ce0f CL |
67 | .Sh EXAMPLES |
68 | In the example below, | |
69 | the first field indicates the command should be executed at the hour, | |
70 | a quarter past the hour, on the half hour and at a quarter to the hour. | |
71 | The next four fields indicate the command should be run every hour, | |
72 | every day. The sixth field indicates the command is to be run with | |
73 | root privileges. | |
74 | .Bd -literal -offset indent | |
75 | 0,15,30,45 * * * * root /usr/libexec/atrun | |
76 | .Ed | |
77 | .Pp | |
96d06c26 KM |
78 | In this next example, |
79 | the first field indicates this command should be executed on the half hour. | |
80 | The second field constrains the hour to 3 A.M. The third and fourth | |
81 | fields indicate any day of the month and any month of the year, but are | |
c033ce0f CL |
82 | constrained by the fifth field to the sixth day of the week (Saturday). |
83 | The command is to be executed with root privileges. The example shown here | |
84 | has been folded (spread across two lines) to make it readable. | |
85 | It must not be folded in the the | |
86 | .Nm crontab | |
87 | file. | |
88 | .Bd -literal -offset indent | |
89 | 30 3 * * 6 root /bin/sh /etc/weekly 2>&1 | tee | |
90 | /var/log/weekly.out | mail -s "weekly output" root | |
91 | .Ed | |
92 | .Sh SEE ALSO | |
93 | .Xr cron 8 | |
94 | .Xr rc 8 | |
95 | .Sh FILES | |
96 | .Bl -tag -width /etc/crontab.local -compact | |
97 | .It Pa /etc/crontab | |
98 | General system tasks. | |
99 | .It Pa /etc/crontab.local | |
100 | Optional local tasks. | |
101 | .It Pa /etc/rc | |
102 | System initialization script (normally, | |
103 | .Nm cron | |
104 | is executed from this script.) | |
105 | .Sh HISTORY | |
106 | A | |
107 | .Nm crontab | |
108 | file appeared in | |
109 | .At v6 . |