⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 crontab.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>crontab</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_001_014_225">&nbsp;</a>NAME</h4><blockquote>crontab - schedule periodic background work</blockquote><h4><a name = "tag_001_014_226">&nbsp;</a>SYNOPSIS</h4><blockquote><pre><code>crontab <b>[</b><i>file</i><b>]</b>crontab <b>[</b> -e | -l | -r <b>]</b></code></pre></blockquote><h4><a name = "tag_001_014_227">&nbsp;</a>DESCRIPTION</h4><blockquote>The<i>crontab</i>utility creates, replaces or edits a user's<i>crontab</i>entry;a crontab entry is a list of commands and the timesat which they are to be executed.The new crontab entry can be input by specifying<i>file</i>or input from standard input if no<i>file</i>operand is specified,or by using an editor, if<b>-e</b>is specified.<p>Upon execution of a command from a crontab entry,the implementation will supplya default environment, defining at leastthe following environment variables:<dl compact><dt><i>HOME</i><dd>A pathname of the user's home directory.<dt><i>LOGNAME</i><dd>The user's login name.<dt><i>PATH</i><dd>A string representing a search path guaranteedto find all of the standard utilities.<dt><i>SHELL</i><dd>A pathname of thecommand interpreter.When<i>crontab</i>is invoked as specified by this specification,the value will be a pathname for<i><a href="sh.html">sh</a></i>.</dl><p>The values of these variables when<i>crontab</i>is invoked as specified by this specificationwill not affect the default values providedwhen the scheduled command is run.<p>If standard output and standard error are not redirectedby commands executed from the crontab entry,any generated output or errors will bemailed, via an implementation-dependent method, to the user.<p>Users are permitted to use<i>crontab</i>if their names appear in the file<b>/usr/lib/cron/cron.allow</b>.If that file does not exist, the file<b>/usr/lib/cron/cron.deny</b>is checked to determine if the usershould be denied access to<i>crontab</i>.If neither file exists, only a process with appropriate privileges isallowed to submit a job.If only<b>cron.deny</b>exists and is empty, global usage is permitted.The<b>cron.allow</b>and<b>cron.deny</b>files consist of one user name per line.</blockquote><h4><a name = "tag_001_014_228">&nbsp;</a>OPTIONS</h4><blockquote>The<i>crontab</i>utility supports the <b>XBD</b> specification, <a href="../xbd/utilconv.html#usg"><b>Utility Syntax Guidelines</b>&nbsp;</a> .<p>The following options are supported:<dl compact><dt><b>-e</b><dd>Edit a copy of the invoking user's crontab entry,or create an empty entry to edit if the crontabentry does not exist.When editing is complete,the entry will be installed as the user's crontab entry.<dt><b>-l</b><dd>(The letter ell.)List the invoking user's crontab entry.<dt><b>-r</b><dd>Remove the invoking user's crontab entry.</dl></blockquote><h4><a name = "tag_001_014_229">&nbsp;</a>OPERANDS</h4><blockquote>The following operand is supported:<dl compact><dt><i>file</i><dd>The pathname of a file that contains specifications, in the formatdefined in the INPUT FILES section, for crontab entries.</dl></blockquote><h4><a name = "tag_001_014_230">&nbsp;</a>STDIN</h4><blockquote>See the INPUT FILES section.</blockquote><h4><a name = "tag_001_014_231">&nbsp;</a>INPUT FILES</h4><blockquote>In the POSIX locale, acrontabentry must be a text file consisting of lines of six fields each.The fields must be separated byblank characters.The first five fields must be integer patterns thatspecify the following:<ol><p><li>Minute (0-59)<p><li>Hour (0-23)<p><li>Day of the month (1-31)<p><li>Month of the year (1-12)<p><li>Day of the week (0-6 with 0=Sunday).<p></ol><p>Each of these patterns canbe either an asterisk (meaning all valid values),an elementor a list of elements separated by commas.An element must be either a number ortwo numbers separated by a hyphen(meaning an inclusive range).The specification of dayscan be made by two fields(day of the month and day of the week).If month, day of month and day of week are allasterisks, every day will be matched.If either the month or dayof month is specified as an element or list, but the day ofweek is an asterisk, the month and day of month fieldswill specify the days that match.If both month and day of monthare specified as asterisk, but day of week is an element orlist, then only the specified days of the week will match.Finally, if either the month or day of month is specified asan element or list, and the day of week is also specified asan element or list, then any day matching either the monthand day of month or the day of week, will be matched.<p>The sixth field of a line in a crontabentry is a string that will be executed by<i><a href="sh.html">sh</a></i>at the specified times.A percent sign character in this field will be translated to anewlinecharacter.Any character preceded by a backslash (including the%)causes that character to be treated literally.Only the first line (up to a "%" or end-of-line)of the command field will be executed by the command interpreter.The other lines will be made available to thecommand as standard input.<p>Blank lines and those whose first non-blankcharacter is"#"will be ignored.<p>The text files<b>/usr/lib/cron/cron.allow</b>and<b>/usr/lib/cron/cron.deny</b>contain user names, one per line, of users who are, respectively,authorised or denied access to the service underlying the<i>crontab</i>utility.</blockquote><h4><a name = "tag_001_014_232">&nbsp;</a>ENVIRONMENT VARIABLES</h4><blockquote>The following environment variables affect the execution of<i>crontab</i>:<dl compact><dt><i>EDITOR</i><dd>Determine the editor to be invoked when the<b>-e</b>option is specified.The default editor is<i><a href="vi.html">vi</a></i>.<dt><i>LANG</i><dd>Provide a default value for the internationalisation variablesthat are unset or null.If<i>LANG</i>is unset or null, the corresponding value from theimplementation-dependent default locale will be used.If any of the internationalisation variables contains an invalid setting, theutility will behave as if none of the variables had been defined.<dt><i>LC_ALL</i><dd>If set to a non-empty string value,override the values of all the other internationalisation variables.<dt><i>LC_CTYPE</i><dd>Determine thelocale for the interpretation of sequences of bytes of text data ascharacters (for example, single- as opposed to multi-byte charactersin arguments and input files).<dt><i>LC_MESSAGES</i><dd>Determine the locale that should be used to affectthe format and contents of diagnosticmessages written to standard error.<dt><i>NLSPATH</i><dd>Determine the location of message cataloguesfor the processing of<i>LC_MESSAGES .</i></dl></blockquote><h4><a name = "tag_001_014_233">&nbsp;</a>ASYNCHRONOUS EVENTS</h4><blockquote>Default.</blockquote><h4><a name = "tag_001_014_234">&nbsp;</a>STDOUT</h4><blockquote>If the<b>-l</b>option is specified, the crontab entry will be written tothe standard output.</blockquote><h4><a name = "tag_001_014_235">&nbsp;</a>STDERR</h4><blockquote>Used only for diagnostic messages.</blockquote><h4><a name = "tag_001_014_236">&nbsp;</a>OUTPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_237">&nbsp;</a>EXTENDED DESCRIPTION</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_238">&nbsp;</a>EXIT STATUS</h4><blockquote>The following exit values are returned:<dl compact><dt>0<dd>Successful completion.<dt>&gt;0<dd>An error occurred.</dl></blockquote><h4><a name = "tag_001_014_239">&nbsp;</a>CONSEQUENCES OF ERRORS</h4><blockquote>The user's crontab entry is not submitted, removed, edited or listed.</blockquote><h4><a name = "tag_001_014_240">&nbsp;</a>APPLICATION USAGE</h4><blockquote>The format of the<i>crontab</i>entry shown here is guaranteed only for the POSIX locale.Other cultures may be supported with substantially differentinterfaces, although implementations are encouraged to providecomparable levels of functionality.<p>The default settings of the<i>HOME ,</i><i>LOGNAME ,</i><i>PATH</i>and<i>SHELL</i>variables that are given to the scheduled job arenot affected by the settings of those variables when<i>crontab</i>is run; as stated, they are defaults.The text about &quot;invoked as specified by this specification&quot;means that the implementation may provide extensionsthat allow these variables to be affectedat runtime, but that the user has to take explicitaction in order to access the extension,such as give a new option flag or modify theformat of the crontab entry.<p>A typical user error is to type only<i>crontab</i>;this will cause the system to wait for the new crontabentry on standard input.If end-of-file is typed (generally&lt;control&gt;-D),the crontab entry will be replaced by an empty file.In this case, the user should type the interrupt character,which will prevent the crontab entry from being replaced.</blockquote><h4><a name = "tag_001_014_241">&nbsp;</a>EXAMPLES</h4><blockquote><ol><p><li>Clean up<b>core</b>files every weekday morning at 3:15 am:<pre><code>15 3 * * 1-5 find $HOME -name core 2&gt;/dev/null | xargs rm -f</code></pre><p><li>Mail a birthday greeting:<pre><code>0 12 14 2 * mailx john%Happy Birthday!%Time for lunch.</code></pre><br><p><li>As an example of specifying the two types of days:<pre><code>0 0 1,15 * 1</code></pre>would run a command on thefirst and fifteenth of each month, as well as on every Monday.To specify days by only one field,the other field should be set to "*"; for example:<pre><code>0 0 * * 1</code></pre>would run a command only on Mondays.<p></ol></blockquote><h4><a name = "tag_001_014_242">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_243">&nbsp;</a>SEE ALSO</h4><blockquote><i><a href="at.html">at</a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX &reg; is a registered Trademark of The Open Group.<br>Copyright &copy; 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>

⌨️ 快捷键说明

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