logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

crontab.1p (11004B)


  1. '\" et
  2. .TH CRONTAB "1P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. crontab
  12. \(em schedule periodic background work
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. crontab \fB[\fIfile\fB]\fR
  17. .P
  18. crontab \fB[\fR-e\||-l|-r\fB]\fR
  19. .fi
  20. .SH DESCRIPTION
  21. The
  22. .IR crontab
  23. utility shall create, replace,
  24. or edit a user's crontab entry;
  25. a crontab entry is a list of commands and the times at which they
  26. shall be executed. The new crontab entry can be input by specifying
  27. .IR file
  28. or input from standard input if no
  29. .IR file
  30. operand is specified,
  31. or by using an editor, if
  32. .BR \-e
  33. is specified.
  34. .P
  35. Upon execution of a command from a crontab entry, the implementation
  36. shall supply a default environment, defining at least the following
  37. environment variables:
  38. .IP "\fIHOME\fP" 10
  39. A pathname of the user's home directory.
  40. .IP "\fILOGNAME\fP" 10
  41. The user's login name.
  42. .IP "\fIPATH\fP" 10
  43. A string representing a search path guaranteed to find all of the
  44. standard utilities.
  45. .IP "\fISHELL\fP" 10
  46. A pathname of the command interpreter. When
  47. .IR crontab
  48. is invoked as specified by this volume of POSIX.1\(hy2017, the value shall be a pathname for
  49. .IR sh .
  50. .P
  51. The values of these variables when
  52. .IR crontab
  53. is invoked as specified by this volume of POSIX.1\(hy2017 shall not affect the default
  54. values provided when the scheduled command is run.
  55. .P
  56. If standard output and standard error are not redirected by commands
  57. executed from the crontab entry, any generated output or errors shall
  58. be mailed, via an implementation-defined method, to the user.
  59. .P
  60. Users shall be permitted to use
  61. .IR crontab
  62. if their names appear in the file
  63. .BR cron.allow
  64. which is located in an implementation-defined directory.
  65. If that file does not exist, the file
  66. .BR cron.deny ,
  67. which is located in an implementation-defined directory,
  68. shall be checked to determine whether the user shall be denied access to
  69. .IR crontab .
  70. If neither file exists, only a process with appropriate privileges shall be
  71. allowed to submit a job. If only
  72. .BR cron.deny
  73. exists and is empty, global usage shall be permitted. The
  74. .BR cron.allow
  75. and
  76. .BR cron.deny
  77. files shall consist of one user name per line.
  78. .SH OPTIONS
  79. The
  80. .IR crontab
  81. utility shall conform to the Base Definitions volume of POSIX.1\(hy2017,
  82. .IR "Section 12.2" ", " "Utility Syntax Guidelines".
  83. .P
  84. The following options shall be supported:
  85. .IP "\fB\-e\fP" 10
  86. Edit a copy of the invoking user's crontab entry, or create an empty
  87. entry to edit if the crontab entry does not exist. When editing is
  88. complete, the entry shall be installed as the user's crontab entry.
  89. .IP "\fB\-l\fP" 10
  90. (The letter ell.) List the invoking user's crontab entry.
  91. .IP "\fB\-r\fP" 10
  92. Remove the invoking user's crontab entry.
  93. .SH OPERANDS
  94. The following operand shall be supported:
  95. .IP "\fIfile\fR" 10
  96. The pathname of a file that contains specifications, in the format
  97. defined in the INPUT FILES section, for crontab entries.
  98. .SH STDIN
  99. See the INPUT FILES section.
  100. .SH "INPUT FILES"
  101. In the POSIX locale, the user or application shall ensure that a
  102. crontab entry is a text file consisting of lines of six fields each.
  103. The fields shall be separated by
  104. <blank>
  105. characters. The first five fields shall be integer patterns that specify
  106. the following:
  107. .IP " 1." 4
  108. Minute [0,59]
  109. .IP " 2." 4
  110. Hour [0,23]
  111. .IP " 3." 4
  112. Day of the month [1,31]
  113. .IP " 4." 4
  114. Month of the year [1,12]
  115. .IP " 5." 4
  116. Day of the week ([0,6] with 0=Sunday)
  117. .P
  118. Each of these patterns can be either an
  119. <asterisk>
  120. (meaning all valid values), an element, or a list of elements separated by
  121. <comma>
  122. characters. An element shall be either a number or two numbers separated
  123. by a
  124. <hyphen-minus>
  125. (meaning an inclusive range). The specification of days can be made by
  126. two fields (day of the month and day of the week). If month, day of
  127. month, and day of week are all
  128. <asterisk>
  129. characters, every day shall be matched. If either the month or day of
  130. month is specified as an element or list, but the day of week is an
  131. <asterisk>,
  132. the month and day of month fields shall specify the days that match. If
  133. both month and day of month are specified as an
  134. <asterisk>,
  135. but day of week is an element or list, then only the specified days of the
  136. week match. Finally, if either the month or day of month is specified as
  137. an element or list, and the day of week is also specified as an element
  138. or list, then any day matching either the month and day of month, or
  139. the day of week, shall be matched.
  140. .P
  141. The sixth field of a line in a crontab entry is a string that shall be
  142. executed by
  143. .IR sh
  144. at the specified times. A
  145. <percent-sign>
  146. character in this field shall be translated to a
  147. <newline>.
  148. Any character preceded by a
  149. <backslash>
  150. (including the
  151. .BR '%' )
  152. shall cause that character to be treated literally. Only the first line
  153. (up to a
  154. .BR '%'
  155. or end-of-line) of the command field shall be executed by the command
  156. interpreter. The other lines shall be made available to the command as
  157. standard input.
  158. .P
  159. Blank lines and those whose first non-\c
  160. <blank>
  161. is
  162. .BR '#'
  163. shall be ignored.
  164. .P
  165. The text files
  166. .BR cron.allow
  167. and
  168. .BR cron.deny ,
  169. which are located in an implementation-defined directory,
  170. shall contain zero or more user names, one per line, of users who are,
  171. respectively, authorized or denied access to the service underlying the
  172. .IR crontab
  173. utility.
  174. .SH "ENVIRONMENT VARIABLES"
  175. The following environment variables shall affect the execution of
  176. .IR crontab :
  177. .IP "\fIEDITOR\fP" 10
  178. Determine the editor to be invoked when the
  179. .BR \-e
  180. option is specified. The default editor shall be
  181. .IR vi .
  182. .IP "\fILANG\fP" 10
  183. Provide a default value for the internationalization variables that are
  184. unset or null. (See the Base Definitions volume of POSIX.1\(hy2017,
  185. .IR "Section 8.2" ", " "Internationalization Variables"
  186. for the precedence of internationalization variables used to determine
  187. the values of locale categories.)
  188. .IP "\fILC_ALL\fP" 10
  189. If set to a non-empty string value, override the values of all the
  190. other internationalization variables.
  191. .IP "\fILC_CTYPE\fP" 10
  192. Determine the locale for the interpretation of sequences of bytes of
  193. text data as characters (for example, single-byte as opposed to
  194. multi-byte characters in arguments and input files).
  195. .IP "\fILC_MESSAGES\fP" 10
  196. .br
  197. Determine the locale that should be used to affect the format and
  198. contents of diagnostic messages written to standard error.
  199. .IP "\fINLSPATH\fP" 10
  200. Determine the location of message catalogs for the processing of
  201. .IR LC_MESSAGES .
  202. .SH "ASYNCHRONOUS EVENTS"
  203. Default.
  204. .SH STDOUT
  205. If the
  206. .BR \-l
  207. option is specified, the crontab entry shall be written to the standard
  208. output.
  209. .SH STDERR
  210. The standard error shall be used only for diagnostic messages.
  211. .SH "OUTPUT FILES"
  212. None.
  213. .SH "EXTENDED DESCRIPTION"
  214. None.
  215. .SH "EXIT STATUS"
  216. The following exit values shall be returned:
  217. .IP "\00" 6
  218. Successful completion.
  219. .IP >0 6
  220. An error occurred.
  221. .SH "CONSEQUENCES OF ERRORS"
  222. The user's crontab entry is not submitted, removed,
  223. edited,
  224. or listed.
  225. .LP
  226. .IR "The following sections are informative."
  227. .SH "APPLICATION USAGE"
  228. The format of the crontab entry shown here is guaranteed only for the
  229. POSIX locale. Other cultures may be supported with substantially
  230. different interfaces, although implementations are encouraged to
  231. provide comparable levels of functionality.
  232. .P
  233. The default settings of the
  234. .IR HOME ,
  235. .IR LOGNAME ,
  236. .IR PATH ,
  237. and
  238. .IR SHELL
  239. variables that are given to the scheduled job are not affected by the
  240. settings of those variables when
  241. .IR crontab
  242. is run; as stated, they are defaults. The text about ``invoked as
  243. specified by this volume of POSIX.1\(hy2017'' means that the implementation may provide
  244. extensions that allow these variables to be affected at runtime, but
  245. that the user has to take explicit action in order to access the
  246. extension, such as give a new option flag or modify the format of the
  247. crontab entry.
  248. .P
  249. A typical user error is to type only
  250. .IR crontab ;
  251. this causes the system to wait for the new crontab entry on standard
  252. input. If end-of-file is typed (generally <control>\(hyD), the crontab
  253. entry is replaced by an empty file. In this case, the user should type
  254. the interrupt character, which prevents the crontab entry from being
  255. replaced.
  256. .SH EXAMPLES
  257. .IP " 1." 4
  258. Clean up
  259. .BR core
  260. files every weekday morning at 3:15 am:
  261. .RS 4
  262. .sp
  263. .RS 4
  264. .nf
  265. 15 3 * * 1-5 find "$HOME" -name core -exec rm -f {} + 2>/dev/null
  266. .fi
  267. .P
  268. .RE
  269. .RE
  270. .IP " 2." 4
  271. Mail a birthday greeting:
  272. .RS 4
  273. .sp
  274. .RS 4
  275. .nf
  276. 0 12 14 2 * mailx john%Happy Birthday!%Time for lunch.
  277. .fi
  278. .P
  279. .RE
  280. .RE
  281. .IP " 3." 4
  282. As an example of specifying the two types of days:
  283. .RS 4
  284. .sp
  285. .RS 4
  286. .nf
  287. 0 0 1,15 * 1
  288. .fi
  289. .P
  290. .RE
  291. .P
  292. would run a command on the first and fifteenth of each month, as well
  293. as on every Monday. To specify days by only one field, the other field
  294. should be set to
  295. .BR '*' ;
  296. for example:
  297. .sp
  298. .RS 4
  299. .nf
  300. 0 0 * * 1
  301. .fi
  302. .P
  303. .RE
  304. .P
  305. would run a command only on Mondays.
  306. .RE
  307. .SH RATIONALE
  308. All references to a
  309. .IR cron
  310. daemon and to
  311. .IR cron
  312. .IR files
  313. have been omitted. Although historical implementations have used this
  314. arrangement, there is no reason to limit future implementations.
  315. .P
  316. This description of
  317. .IR crontab
  318. is designed to support only users with normal privileges. The format of
  319. the input is based on the System V
  320. .IR crontab ;
  321. however, there is no requirement here that the actual system database
  322. used by the
  323. .IR cron
  324. daemon (or a similar mechanism) use this format internally. For
  325. example, systems derived from BSD are likely to have an additional
  326. field appended that indicates the user identity to be used when the job
  327. is submitted.
  328. .P
  329. The
  330. .BR \-e
  331. option was adopted from the SVID as a user convenience, although it
  332. does not exist in all historical implementations.
  333. .SH "FUTURE DIRECTIONS"
  334. None.
  335. .SH "SEE ALSO"
  336. .IR "\fIat\fR\^"
  337. .P
  338. The Base Definitions volume of POSIX.1\(hy2017,
  339. .IR "Chapter 8" ", " "Environment Variables",
  340. .IR "Section 12.2" ", " "Utility Syntax Guidelines"
  341. .\"
  342. .SH COPYRIGHT
  343. Portions of this text are reprinted and reproduced in electronic form
  344. from IEEE Std 1003.1-2017, Standard for Information Technology
  345. -- Portable Operating System Interface (POSIX), The Open Group Base
  346. Specifications Issue 7, 2018 Edition,
  347. Copyright (C) 2018 by the Institute of
  348. Electrical and Electronics Engineers, Inc and The Open Group.
  349. In the event of any discrepancy between this version and the original IEEE and
  350. The Open Group Standard, the original IEEE and The Open Group Standard
  351. is the referee document. The original Standard can be obtained online at
  352. http://www.opengroup.org/unix/online.html .
  353. .PP
  354. Any typographical or formatting errors that appear
  355. in this page are most likely
  356. to have been introduced during the conversion of the source files to
  357. man page format. To report such errors, see
  358. https://www.kernel.org/doc/man-pages/reporting_bugs.html .