crontab.5

来自「minix操作系统最新版本(3.1.1)的源代码」· 5 代码 · 共 138 行

5
138
字号
.TH CRONTAB 5.SH NAMEcrontab \- table of jobs to be performed by cron.SH SYNOPSIS.nf.ft B/usr/lib/crontab/usr/local/lib/crontab/var/lib/crontab/var/opt/\fIname\fP/lib/crontab\ \ \fR(Minix-vmd only)\fB/usr/spool/crontabs/\fIuser\fP.ft R.fi.SH DESCRIPTIONThe.BR cron (8)daemon runs jobs at regular intervals.  These jobs are listed in.B crontabfiles.  The format of entries in a crontab file are five fields of numbersspecifying the minute (0\-59), hour (0\-23), day of the month (1\-31), month(1\-12), and day of the week (0\-6 with 0 = Sunday) that a task must beexecuted.  The task to be executed follows as a shell command..PPThe time numbers can be given as a comma separated list of simple numbers,ranges ("2\-5" is the same as "2,3,4,5"), and repeats ("2:5" means"2,7,12,17,22" in the hour field).  A repeat is cyclic affair, i.e. 2:5and 12:5 are the same thing.  A single "*" can be used in a field toindicate all valid numbers in that field, so it translates to "always".  Inthe minute field you can use "?" for the current minute that the crontabfile is loaded.  It can be used in a repeat, i.e. "?:10" for every 10minutes.  This keeps machines with identical crontabs from executing tasksat exactly the same time, causing a burst of traffic if anything is doneover a network..PPIf a given time is valid in all five fields then a command is executed.Here are a few examples that illustrate the possibilities:.PP.if t .RS.if t .ft C.nf# min hour mday mon wday command   ?   3    *    *   *   /usr/etc/daily  # Daily system cleanup   0   *    *    *   *   date            # Print date on the hour  30   4    *    *  2\-6  /var/etc/backup # After workdays on 4:30   0   9   25   12   *   \-u ast sing     # Andy sings on Xmas morning   0   0   13    *   5   echo Beware!    # For the superstitious.fi.if t .ft P.if t .RE.PPThe command may optionally be prefixed by.BI \-u " user"to specify under which user the command should be run.  Commands fromcrontabs in the spool directory are always run under the id of the crontab'sowner, the.B \-uflag is ignored..PPA command can be placed on the same line as the time fields, or on the nextline indented by one TAB character.  (A TAB, not eight spaces.)  More TABindented lines can be added for a multiline command.  The tabs are removedfrom the command when passed to the shell.  If a command is put on the sameline as the time fields then percent characters are changed into newlines,this is not done for a TAB indented command.  The following three entriesgive the same output:.PP.RS.if t .ft C.nf.ta +8n0 12  *  *  *   echo 'Hello'; echo '  World!'#10 12  *  *  *   echo 'Hello%  World!'  #20 12  *  *  *        #3	cat <<EOF    #4	Hello	\&  World!	EOF.fi.if t .ft P.RE.PPComments start with a "#" character and continue until end of line.  They,excess whitespace, and empty lines are ignored.  Of the comments in theexample above #1 and #3 are ignored by.BR cron ,but #2 and #4 are not recognized as comments, but are seen as part of acommand and are passed to the shell who then happens to ignore them.  Thereis no interpretation of command characters other than the percent in aoneliner.  The time fields must all be on the same line..SH FILES.TP 25n.B /usr/lib/crontabMain MINIX 3 crontab file..TP.B /usr/local/lib/crontabLocal jobs for all systems in an organization..TP.B /var/lib/crontabSystem specific jobs..TP.B /var/opt/\fIname\fP/lib/crontabPer package jobs for Minix-vmd..TP.B /usr/lib/packagesList of installed packages..TP.B /usr/spool/crontabs/\fIuser\fPPer user jobs..SH "SEE ALSO".BR crontab (1),.BR cron (8)..SH NOTESThe "?" in the minute field, the repeat field (e.g. "2:5"), TAB indentedmultiline commands and the.B \-uoption are unique to this cron implementation.  This doesn't mean youshouldn't use these features, but just that you should be aware of thedifferences with other systems.  You are even advised to use these featuresand avoid the percent hack for multiline commands..PPOther crons allow one to specify input to a job in some way, something thiscron can't.  Simply use the << shell feature to do that.  Other crons oftenchoke on empty lines..PPIt is a common bug to use 0 for Sunday instead of 7.  This cron, like mostother crons out there accepts this without comment..PPA job is not reissued until a previous instance of it has exited.  The nexttime to execute is computed from the previous time it ran.  If job issuinglags behind on the system time then the next time to run it is computed fromthe current system time..SH AUTHORKees J. Bot (kjb@cs.vu.nl).\".\" $PchId: crontab.5,v 1.3 2000/07/17 18:53:05 philip Exp $

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?