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