Un outil pour savoir si une commande est posix - retour accueil
git clone git://bebou.netlib.re/isposix
Log | Files | Refs | README |
crontab.html (18244B)
1 <!-- Copyright 2001-2024 IEEE and The Open Group, All Rights Reserved --> 2 <!DOCTYPE HTML> 3 <html lang="en"> 4 <head> 5 <meta name="generator" content="HTML Tidy for HTML5 for Linux version 5.8.0"> 6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 7 <link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group rhtm tool v1.2.4 --> 8 <!-- Copyright (c) 2001-2024 The Open Group, All Rights Reserved --> 9 <title>crontab</title> 10 </head> 11 <body bgcolor="white"> 12 <div class="NAVHEADER"> 13 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0"> 14 <tr class="nav"> 15 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/cp.html" accesskey="P"><<< 16 Previous</a></td> 17 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td> 18 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/csplit.html" accesskey="N">Next 19 >>></a></td> 20 </tr> 21 </table> 22 <hr align="left" width="100%"></div> 23 <script language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> 24 <center><font size="2">The Open Group Base Specifications Issue 8<br> 25 IEEE Std 1003.1-2024<br> 26 Copyright © 2001-2024 The IEEE and The Open Group</font></center> 27 <hr size="2" noshade> 28 <a name="top" id="top"></a> <a name="crontab" id="crontab"></a> <a name="tag_20_25" id="tag_20_25"></a><!-- crontab --> 29 <h4 class="mansect"><a name="tag_20_25_01" id="tag_20_25_01"></a>NAME</h4> 30 <blockquote>crontab — schedule periodic background work</blockquote> 31 <h4 class="mansect"><a name="tag_20_25_02" id="tag_20_25_02"></a>SYNOPSIS</h4> 32 <blockquote class="synopsis"> 33 <p><code><tt>crontab</tt> <b>[</b><i>file</i><b>]</b> <tt><br> 34 <br> 35 <sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> crontab</tt> <b>[</b><tt><img src="../images/opt-start.gif" border= 36 "0">-e<img src="../images/opt-end.gif" border="0">|-l|-r</tt><b>]</b> <tt><br></tt></code></p> 37 </blockquote> 38 <h4 class="mansect"><a name="tag_20_25_03" id="tag_20_25_03"></a>DESCRIPTION</h4> 39 <blockquote> 40 <p>The <i>crontab</i> utility shall create, replace, <sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src= 41 "../images/opt-start.gif" alt="[Option Start]" border="0"> or edit a user's crontab entry; <img src="../images/opt-end.gif" 42 alt="[Option End]" border="0"> a crontab entry is a list of commands and the times at which they shall be executed. The new 43 crontab entry can be input by specifying <i>file</i> or input from standard input if no <i>file</i> operand is specified, 44 <sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 45 or by using an editor, if <b>-e</b> is specified. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p> 46 <p>Upon execution of a command from a crontab entry, the implementation shall supply a default environment, defining at least the 47 following environment variables:</p> 48 <dl compact> 49 <dd></dd> 50 <dt><i>HOME</i></dt> 51 <dd>A pathname of the user's home directory.</dd> 52 <dt><i>LOGNAME</i></dt> 53 <dd>The user's login name.</dd> 54 <dt><i>PATH</i></dt> 55 <dd>A string representing a search path guaranteed to find all of the standard utilities.</dd> 56 <dt><i>SHELL</i></dt> 57 <dd>A pathname of the command interpreter. When <i>crontab</i> is invoked as specified by this volume of POSIX.1-2024, the value 58 shall be a pathname for <a href="../utilities/sh.html"><i>sh</i></a>.</dd> 59 </dl> 60 <p>The values of these variables when <i>crontab</i> is invoked as specified by this volume of POSIX.1-2024 shall not affect the 61 default values provided when the scheduled command is run.</p> 62 <p>If standard output and standard error are not redirected by commands executed from the crontab entry, any generated output or 63 errors shall be mailed, via an implementation-defined method, to the user.</p> 64 <p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 65 Users shall be permitted to use <i>crontab</i> if their names appear in the file <b>cron.allow</b> which is located in an 66 implementation-defined directory. If that file does not exist, the file <b>cron.deny</b>, which is located in an 67 implementation-defined directory, shall be checked to determine whether the user shall be denied access to <i>crontab</i>. If 68 neither file exists, only a process with appropriate privileges shall be allowed to submit a job. If only <b>cron.deny</b> exists 69 and is empty, global usage shall be permitted. The <b>cron.allow</b> and <b>cron.deny</b> files shall consist of one user name per 70 line. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p> 71 </blockquote> 72 <h4 class="mansect"><a name="tag_20_25_04" id="tag_20_25_04"></a>OPTIONS</h4> 73 <blockquote> 74 <p>The <i>crontab</i> utility shall conform to XBD <a href="../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax 75 Guidelines</i></a> .</p> 76 <p>The following options shall be supported:</p> 77 <dl compact> 78 <dd></dd> 79 <dt><b>-e</b></dt> 80 <dd><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 81 Edit a copy of the invoking user's crontab entry, or create an empty entry to edit if the crontab entry does not exist. When 82 editing is complete, the entry shall be installed as the user's crontab entry. <img src="../images/opt-end.gif" alt="[Option End]" 83 border="0"></dd> 84 <dt><b>-l</b></dt> 85 <dd>(The letter ell.) List the invoking user's crontab entry.</dd> 86 <dt><b>-r</b></dt> 87 <dd>Remove the invoking user's crontab entry.</dd> 88 </dl> 89 </blockquote> 90 <h4 class="mansect"><a name="tag_20_25_05" id="tag_20_25_05"></a>OPERANDS</h4> 91 <blockquote> 92 <p>The following operand shall be supported:</p> 93 <dl compact> 94 <dd></dd> 95 <dt><i>file</i></dt> 96 <dd>The pathname of a file that contains specifications, in the format defined in the INPUT FILES section, for crontab 97 entries.</dd> 98 </dl> 99 </blockquote> 100 <h4 class="mansect"><a name="tag_20_25_06" id="tag_20_25_06"></a>STDIN</h4> 101 <blockquote> 102 <p>See the INPUT FILES section.</p> 103 </blockquote> 104 <h4 class="mansect"><a name="tag_20_25_07" id="tag_20_25_07"></a>INPUT FILES</h4> 105 <blockquote> 106 <p>In the POSIX locale, the user or application shall ensure that a crontab entry is a text file consisting of lines of six fields 107 each. The fields shall be separated by <blank> characters. The first five fields shall be integer patterns that specify the 108 following:</p> 109 <ol> 110 <li> 111 <p>Minute [0,59]</p> 112 </li> 113 <li> 114 <p>Hour [0,23]</p> 115 </li> 116 <li> 117 <p>Day of the month [1,31]</p> 118 </li> 119 <li> 120 <p>Month of the year [1,12]</p> 121 </li> 122 <li> 123 <p>Day of the week ([0,6] with 0=Sunday)</p> 124 </li> 125 </ol> 126 <p>Each of these patterns can be either an <asterisk> (meaning all valid values), an element, or a list of elements separated 127 by <comma> characters. An element shall be either a number or two numbers separated by a <hyphen-minus> (meaning an 128 inclusive range). The specification of days can be made by two fields (day of the month and day of the week). If month, day of 129 month, and day of week are all <asterisk> characters, every day shall be matched. If either the month or day of month is 130 specified as an element or list, but the day of week is an <asterisk>, the month and day of month fields shall specify the 131 days that match. If both month and day of month are specified as an <asterisk>, but day of week is an element or list, then 132 only the specified days of the week match. Finally, if either the month or day of month is specified as an element or list, and the 133 day of week is also specified as an element or list, then any day matching either the month and day of month, or the day of week, 134 shall be matched.</p> 135 <p>The sixth field of a line in a crontab entry is a string that shall be executed by <a href="../utilities/sh.html"><i>sh</i></a> 136 at the specified times. A <percent-sign> character in this field shall be translated to a <newline>. Any character 137 preceded by a <backslash> (including the <tt>'%'</tt>) shall cause that character to be treated literally. Only the first 138 line (up to a <tt>'%'</tt> or end-of-line) of the command field shall be executed by the command interpreter. The other lines shall 139 be made available to the command as standard input.</p> 140 <p>Blank lines and those whose first non-<blank> is <tt>'#'</tt> shall be ignored.</p> 141 <p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 142 The text files <b>cron.allow</b> and <b>cron.deny</b>, which are located in an implementation-defined directory, shall contain zero 143 or more user names, one per line, of users who are, respectively, authorized or denied access to the service underlying the 144 <i>crontab</i> utility. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p> 145 </blockquote> 146 <h4 class="mansect"><a name="tag_20_25_08" id="tag_20_25_08"></a>ENVIRONMENT VARIABLES</h4> 147 <blockquote> 148 <p>The following environment variables shall affect the execution of <i>crontab</i>:</p> 149 <dl compact> 150 <dd></dd> 151 <dt><i>EDITOR</i></dt> 152 <dd>Determine the editor to be invoked when the <b>-e</b> option is specified. The default editor shall be <a href= 153 "../utilities/vi.html"><i>vi</i></a>.</dd> 154 <dt><i>LANG</i></dt> 155 <dd>Provide a default value for the internationalization variables that are unset or null. (See XBD <a href= 156 "../basedefs/V1_chap08.html#tag_08_02"><i>8.2 Internationalization Variables</i></a> for the precedence of internationalization 157 variables used to determine the values of locale categories.)</dd> 158 <dt><i>LC_ALL</i></dt> 159 <dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd> 160 <dt><i>LC_CTYPE</i></dt> 161 <dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as 162 opposed to multi-byte characters in arguments and input files).</dd> 163 <dt><i>LC_MESSAGES</i></dt> 164 <dd><br> 165 Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.</dd> 166 <dt><i>NLSPATH</i></dt> 167 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 168 Determine the location of messages objects and message catalogs. <img src="../images/opt-end.gif" alt="[Option End]" border= 169 "0"></dd> 170 </dl> 171 </blockquote> 172 <h4 class="mansect"><a name="tag_20_25_09" id="tag_20_25_09"></a>ASYNCHRONOUS EVENTS</h4> 173 <blockquote> 174 <p>Default.</p> 175 </blockquote> 176 <h4 class="mansect"><a name="tag_20_25_10" id="tag_20_25_10"></a>STDOUT</h4> 177 <blockquote> 178 <p>If the <b>-l</b> option is specified, the crontab entry shall be written to the standard output.</p> 179 </blockquote> 180 <h4 class="mansect"><a name="tag_20_25_11" id="tag_20_25_11"></a>STDERR</h4> 181 <blockquote> 182 <p>The standard error shall be used only for diagnostic messages.</p> 183 </blockquote> 184 <h4 class="mansect"><a name="tag_20_25_12" id="tag_20_25_12"></a>OUTPUT FILES</h4> 185 <blockquote> 186 <p>None.</p> 187 </blockquote> 188 <h4 class="mansect"><a name="tag_20_25_13" id="tag_20_25_13"></a>EXTENDED DESCRIPTION</h4> 189 <blockquote> 190 <p>None.</p> 191 </blockquote> 192 <h4 class="mansect"><a name="tag_20_25_14" id="tag_20_25_14"></a>EXIT STATUS</h4> 193 <blockquote> 194 <p>The following exit values shall be returned:</p> 195 <dl compact> 196 <dd></dd> 197 <dt> 0</dt> 198 <dd>Successful completion.</dd> 199 <dt>>0</dt> 200 <dd>An error occurred.</dd> 201 </dl> 202 </blockquote> 203 <h4 class="mansect"><a name="tag_20_25_15" id="tag_20_25_15"></a>CONSEQUENCES OF ERRORS</h4> 204 <blockquote> 205 <p>The user's crontab entry is not submitted, removed, <sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src= 206 "../images/opt-start.gif" alt="[Option Start]" border="0"> edited, <img src="../images/opt-end.gif" alt="[Option End]" 207 border="0"> or listed.</p> 208 </blockquote> 209 <hr> 210 <div class="box"><em>The following sections are informative.</em></div> 211 <h4 class="mansect"><a name="tag_20_25_16" id="tag_20_25_16"></a>APPLICATION USAGE</h4> 212 <blockquote> 213 <p>The format of the crontab entry shown here is guaranteed only for the POSIX locale. Other cultures may be supported with 214 substantially different interfaces, although implementations are encouraged to provide comparable levels of functionality.</p> 215 <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 216 scheduled job are not affected by the settings of those variables when <i>crontab</i> is run; as stated, they are defaults. The 217 text about "invoked as specified by this volume of POSIX.1-2024" means that the implementation may provide extensions that allow 218 these variables to be affected at runtime, but that the user has to take explicit action in order to access the extension, such as 219 give a new option flag or modify the format of the crontab entry.</p> 220 <p>A typical user error is to type only <i>crontab</i>; this causes the system to wait for the new crontab entry on standard input. 221 If end-of-file is typed (generally <control>-D), the crontab entry is replaced by an empty file. In this case, the user 222 should type the interrupt character, which prevents the crontab entry from being replaced.</p> 223 </blockquote> 224 <h4 class="mansect"><a name="tag_20_25_17" id="tag_20_25_17"></a>EXAMPLES</h4> 225 <blockquote> 226 <ol> 227 <li> 228 <p>Clean up files named <b>core</b> every weekday morning at 3:15 am:</p> 229 <pre> 230 <tt>15 3 * * 1-5 find "$HOME" -name core -exec rm -f {} + 2>/dev/null 231 </tt></pre></li> 232 <li> 233 <p>Mail a birthday greeting:</p> 234 <pre> 235 <tt>0 12 14 2 * mailx john%Happy Birthday!%Time for lunch. 236 </tt></pre></li> 237 <li> 238 <p>As an example of specifying the two types of days:</p> 239 <pre> 240 <tt>0 0 1,15 * 1 241 </tt></pre> 242 <p>would run a command on the first and fifteenth of each month, as well as on every Monday. To specify days by only one field, the 243 other field should be set to <tt>'*'</tt>; for example:</p> 244 <pre> 245 <tt>0 0 * * 1 246 </tt></pre> 247 <p>would run a command only on Mondays.</p> 248 </li> 249 </ol> 250 </blockquote> 251 <h4 class="mansect"><a name="tag_20_25_18" id="tag_20_25_18"></a>RATIONALE</h4> 252 <blockquote> 253 <p>All references to a <i>cron</i> daemon and to <i>cron</i> <i>files</i> have been omitted. Although historical implementations 254 have used this arrangement, there is no reason to limit future implementations.</p> 255 <p>This description of <i>crontab</i> is designed to support only users with normal privileges. The format of the input is based on 256 the System V <i>crontab</i>; however, there is no requirement here that the actual system database used by the <i>cron</i> daemon 257 (or a similar mechanism) use this format internally. For example, systems derived from BSD are likely to have an additional field 258 appended that indicates the user identity to be used when the job is submitted.</p> 259 <p>The <b>-e</b> option was adopted from the SVID as a user convenience, although it does not exist in all historical 260 implementations.</p> 261 </blockquote> 262 <h4 class="mansect"><a name="tag_20_25_19" id="tag_20_25_19"></a>FUTURE DIRECTIONS</h4> 263 <blockquote> 264 <p>None.</p> 265 </blockquote> 266 <h4 class="mansect"><a name="tag_20_25_20" id="tag_20_25_20"></a>SEE ALSO</h4> 267 <blockquote> 268 <p><a href="../utilities/at.html#"><i>at</i></a></p> 269 <p>XBD <a href="../basedefs/V1_chap08.html#tag_08"><i>8. Environment Variables</i></a> , <a href= 270 "../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax Guidelines</i></a></p> 271 </blockquote> 272 <h4 class="mansect"><a name="tag_20_25_21" id="tag_20_25_21"></a>CHANGE HISTORY</h4> 273 <blockquote> 274 <p>First released in Issue 2.</p> 275 </blockquote> 276 <h4 class="mansect"><a name="tag_20_25_22" id="tag_20_25_22"></a>Issue 6</h4> 277 <blockquote> 278 <p>This utility is marked as part of the User Portability Utilities option.</p> 279 <p>The normative text is reworded to avoid use of the term "must" for application requirements.</p> 280 </blockquote> 281 <h4 class="mansect"><a name="tag_20_25_23" id="tag_20_25_23"></a>Issue 7</h4> 282 <blockquote> 283 <p>The <i>crontab</i> utility (except for the <b>-e</b> option) is moved from the User Portability Utilities option to the Base. 284 User Portability Utilities is now an option for interactive utilities.</p> 285 <p>SD5-XCU-ERN-95 is applied, removing the references to fixed locations for the files referenced by the <i>crontab</i> 286 utility.</p> 287 <p>SD5-XCU-ERN-97 is applied, updating the SYNOPSIS.</p> 288 <p>The first example is changed to remove the unreliable use of <a href="../utilities/find.html"><i>find</i></a> | <a href= 289 "../utilities/xargs.html"><i>xargs</i></a>.</p> 290 <p>POSIX.1-2008, Technical Corrigendum 2, XCU/TC2-2008/0079 [584] is applied.</p> 291 </blockquote> 292 <h4 class="mansect"><a name="tag_20_25_24" id="tag_20_25_24"></a>Issue 8</h4> 293 <blockquote> 294 <p>Austin Group Defect 1122 is applied, changing the description of <i>NLSPATH .</i></p> 295 <p>Austin Group Defect 1141 is applied, changing "core files" to "files named core".</p> 296 </blockquote> 297 <div class="box"><em>End of informative text.</em></div> 298 <hr> 299 <p> </p> 300 <a href="#top"><span class="topOfPage">return to top of page</span></a><br> 301 <hr size="2" noshade> 302 <center><font size="2">UNIX® is a registered Trademark of The Open Group.<br> 303 POSIX™ is a Trademark of The IEEE.<br> 304 Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved<br> 305 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href= 306 "../functions/contents.html">XSH</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../xrat/contents.html">XRAT</a> 307 ]</font></center> 308 <hr size="2" noshade> 309 <div class="NAVHEADER"> 310 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0"> 311 <tr class="nav"> 312 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/cp.html" accesskey="P"><<< 313 Previous</a></td> 314 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td> 315 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/csplit.html" accesskey="N">Next 316 >>></a></td> 317 </tr> 318 </table> 319 <hr align="left" width="100%"></div> 320 </body> 321 </html>