xref: /original-bsd/usr.sbin/cron/crontab.5 (revision 9607209b)
10933e105Sbostic.\" Copyright (c) 1991, 1993
20933e105Sbostic.\"	The Regents of the University of California.  All rights reserved.
39d271dccScael.\"
49d271dccScael.\" %sccs.include.redist.roff%
59d271dccScael.\"
6*9607209bSah.\"     @(#)crontab.5	8.4 (Berkeley) 06/01/94
79d271dccScael.\"
89d271dccScael.Dd
9b5e33bd9Smckusick.Dt CRONTAB 5
109d271dccScael.Os
119d271dccScael.Sh NAME
129d271dccScael.Nm crontab
139d271dccScael.Nd chronological services schedule file
149d271dccScael.Sh SYNOPSIS
159d271dccScael.Nm crontab
169d271dccScael.Sh DESCRIPTION
179d271dccScaelThe
189d271dccScael.Nm crontab
19a1b9dde4Smckusickfile contains the schedules used by the
209d271dccScael.Xr cron 8
219d271dccScaeldaemon.
229d271dccScaelEach line in the schedule gives a time of execution
239d271dccScaeland the command to be executed.
249d271dccScael.Pp
259d271dccScaelA line consists of
269d271dccScaeltwo fields giving the time,
279d271dccScaelthree fields giving the day,
289d271dccScaela user name field,
299d271dccScaeland lastly the command to be
309d271dccScaelexecuted.
319d271dccScaelThe first five fields are space
329d271dccScaelor tab
339d271dccScaelseparated and may
349d271dccScaelconsist of a number,
359d271dccScaela comma separated list of numbers,
369d271dccScaelor an asterisk meaning any or all possible values.
379d271dccScaelThe last field (the command field) may contain spaces.
389d271dccScaelA field containing two hyphen separated numbers is treated as
399d271dccScaelan inclusive range.
409d271dccScael.Pp
419d271dccScaelThe fields are:
429d271dccScael.Bl -enum -offset indent
439d271dccScael.It
449d271dccScaelThe minute of the hour, a number from 0 to 59.
459d271dccScael.It
469d271dccScaelThe hour, a number from 0 to 23.
479d271dccScael.It
489d271dccScaelThe day in terms of the month, a number from 1 to 31.
499d271dccScael.It
50a1b9dde4SmckusickThe month in terms of the year, a number from 1 to 12.
519d271dccScael.It
529d271dccScaelThe day in terms of the week, a number from 1 to 7.
539d271dccScaelMonday is considered day one, Sunday is day seven.
549d271dccScael.It
559d271dccScaelThe name of a user: the command will be run with the
569d271dccScaeluser's uid and permissions.
579d271dccScael.It
589d271dccScaelThe command to execute.  This field may be terminated with a
59a1b9dde4Smckusicknewline or the
609d271dccScael.Ql %
619d271dccScaelcharacter.
629d271dccScael.El
639d271dccScael.Pp
649d271dccScaelAn optional file
659d271dccScael.Nm crontab.local
66a1b9dde4Smckusickmay be created and used for additional scheduling.
679d271dccScael.Sh EXAMPLES
689d271dccScaelIn the example below,
699d271dccScaelthe first field indicates the command should be executed at the hour,
709d271dccScaela quarter past the hour, on the half hour and at a quarter to the hour.
719d271dccScaelThe next four fields indicate the command should be run every hour,
729d271dccScaelevery day. The sixth field indicates the command is to be run with
739d271dccScaelroot privileges.
749d271dccScael.Bd -literal -offset indent
759d271dccScael0,15,30,45 * * * *      root /usr/libexec/atrun
769d271dccScael.Ed
779d271dccScael.Pp
78a1b9dde4SmckusickIn this next example,
79a1b9dde4Smckusickthe first field indicates this command should be executed on the half hour.
80a1b9dde4SmckusickThe second field constrains the hour to 3 A.M. The third and fourth
81a1b9dde4Smckusickfields indicate any day of the month and any month of the year, but are
829d271dccScaelconstrained by the fifth field to the sixth day of the week (Saturday).
839d271dccScaelThe command is to be executed with root privileges. The example shown here
849d271dccScaelhas been folded (spread across two lines) to make it readable.
859d271dccScaelIt must not be folded in the the
869d271dccScael.Nm crontab
879d271dccScaelfile.
889d271dccScael.Bd -literal -offset indent
899d271dccScael30 3 * * 6      root    /bin/sh /etc/weekly 2>&1 | tee
909d271dccScael	/var/log/weekly.out | mail -s "weekly output" root
919d271dccScael.Ed
929d271dccScael.Sh SEE ALSO
939d271dccScael.Xr cron 8
949d271dccScael.Xr rc 8
95*9607209bSah.ne 1i
969d271dccScael.Sh FILES
979d271dccScael.Bl -tag -width /etc/crontab.local -compact
989d271dccScael.It Pa /etc/crontab
999d271dccScaelGeneral system tasks.
1009d271dccScael.It Pa /etc/crontab.local
1019d271dccScaelOptional local tasks.
1029d271dccScael.It Pa /etc/rc
1039d271dccScaelSystem initialization script (normally,
1049d271dccScael.Nm cron
1059d271dccScaelis executed from this script.)
1069d271dccScael.Sh HISTORY
1079d271dccScaelA
1089d271dccScael.Nm crontab
1099d271dccScaelfile appeared in
1109d271dccScael.At v6 .
111