Debian Codegraph @

upstream/debian-trixie/man1/crontab.1

raw
1 '\" t
2 .\" Title: Crontab
3 .\" Author: Paul Vixie <[email protected]>
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\" Date: 06/13/2025
6 .\" Manual: crontab User Manual
7 .\" Source: crontab
8 .\" Language: English
9 .\"
10 .TH "CRONTAB" "1" "06/13/2025" "crontab" "crontab User Manual"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 crontab \- maintain crontab files for individual users (Vixie Cron)
32 .SH "SYNOPSIS"
33 .HP \w'\fBcrontab\fR\ 'u
34 \fBcrontab\fR [\fB\-h\fR]
35 .HP \w'\fBcrontab\fR\ 'u
36 \fBcrontab\fR [\fB\-u\ \fR\fB\fIuser\fR\fR] [\fB\-n\fR] \fB\fIfile\fR\fR
37 .HP \w'\fBcrontab\fR\ 'u
38 \fBcrontab\fR [\fB\-u\ \fR\fB\fIuser\fR\fR] [\fB\-i\fR] {\fB\-e\fR\ |\ \fB\-l\fR\ |\ \fB\-r\fR}
39 .SH "DESCRIPTION"
40 .PP
41 \fBcrontab\fR
42 is the program used to install, deinstall or list the tables used to drive the
43 \fBcron\fR(8)
44 daemon in Vixie Cron\&. Each user can have their own crontab, and though these are files in
45 \fI/var/spool/cron/crontabs\fR, they are not intended to be edited directly\&.
46 .PP
47 If the
48 \fI/etc/cron\&.allow\fR
49 file exists, then you must be listed (one user per line) therein in order to be allowed to use this command\&. If the
50 \fI/etc/cron\&.allow\fR
51 file does not exist but the
52 \fI/etc/cron\&.deny\fR
53 file does exist, then you must not be listed in the
54 \fI/etc/cron\&.deny\fR
55 file in order to use this command\&.
56 .PP
57 If neither of these files exists, then depending on site\-dependent configuration parameters, only the super user will be allowed to use this command, or all users will be able to use this command\&.
58 .PP
59 If both files exist then
60 \fI/etc/cron\&.allow\fR
61 takes precedence\&. Which means that
62 \fI/etc/cron\&.deny\fR
63 is not considered and your user must be listed in
64 \fI/etc/cron\&.allow\fR
65 in order to be able to use the crontab\&.
66 .PP
67 Regardless of the existence of any of these files, the root administrative user is always allowed to setup a crontab\&. For standard Debian systems, all users may use this command\&.
68 .PP
69 If the
70 \fB\-h\fR
71 option is given,
72 \fBcrontab\fR
73 shows a help message and quits immediately\&.
74 .PP
75 If the
76 \fB\-u\fR
77 option is given, it specifies the name of the user whose crontab is to be used (when listing) or modified (when editing)\&. If this option is not given,
78 \fBcrontab\fR
79 examines "your" crontab file, i\&.e\&., the crontab file of the person executing the command\&. Note that
80 \fBsu\fR(8)
81 can confuse
82 \fBcrontab\fR
83 and that if you are running inside of
84 \fBsu\fR(8)
85 you should always use the
86 \fB\-u\fR
87 option for safety\*(Aqs sake\&.
88 .PP
89 The first form of this command is used to install a new crontab from some named file or standard input if the pseudo\-filename ``\-\*(Aq\*(Aq is given\&.
90 .PP
91 If the
92 \fI\-n\fR
93 option is given, it means "dry run":
94 \fBcrontab\fR
95 examines "your" crontab for its syntax, and outputs a success message if this syntax is correct, but nothing is written to any crontab\&.
96 .PP
97 The
98 \fI\-l\fR
99 option causes the current crontab to be displayed on standard output\&. See the note under
100 the section called \(lqDEBIAN SPECIFIC\(rq
101 below\&.
102 .PP
103 The
104 \fB\-r\fR
105 option causes the current crontab to be removed\&.
106 .PP
107 The
108 \fB\-e\fR
109 option is used to edit the current crontab using
110 \fBsensible-editor\fR(1)\&. After you exit from the editor, the modified crontab will be installed automatically\&.
111 .PP
112 The
113 \fI\-i\fR
114 option modifies the
115 \fI\-r\fR
116 option to prompt the user for a \*(Aqy/Y\*(Aq response before actually removing the crontab\&.
117 .SH "DEBIAN SPECIFIC"
118 .PP
119 The "out\-of\-the\-box" behaviour for
120 \fBcrontab \-l\fR
121 is to display the three line "DO NOT EDIT THIS FILE" header that is placed at the beginning of the crontab when it is installed\&. The problem is that it makes the sequence
122 .PP
123 \fBcrontab \-l | crontab \-\fR
124 .PP
125 non\-idempotent \(em you keep adding copies of the header\&. This causes pain to scripts that use sed to edit a crontab\&. Therefore, the default behaviour of the
126 \fI\-l\fR
127 option has been changed to not output such header\&. You may obtain the original behaviour by setting the environment variable
128 \fBCRONTAB_NOHEADER\fR
129 to \*(AqN\*(Aq, which will cause the
130 \fBcrontab \-l\fR
131 command to emit the extraneous header\&.
132 .SH "HIGHLIGHTING THE OUTPUT OF CRONTAB \-L"
133 .PP
134 The command
135 \fBcrontab \-l\fR
136 outputs plain text\&. When a tty can support ANSI sequences to colourise this text, one can highlight the output, by calling:
137 \fBcrontab \-l | spc \-t crontab\fR
138 when the ttybackground is dark, or
139 \fBcrontab \-l | spc \-t crontab\-light\fR
140 when this background is light\&.
141 .PP
142 The highlighting scheme can be modified by using customised versions of files
143 \fI/etc/supercat/spcrc\-crontab*\fR
144 .PP
145 One can also colourise this text with the program
146 \fBbatcat\fR(1)
147 provided by the package
148 \fBbat\fR, here is an example:
149 .PP
150 \fBcrontab \-l | batcat \-\-language Crontab\fR
151 .SH "SEE ALSO"
152 .PP
153 \fBcrontab\fR(5),
154 \fBcron\fR(8),
155 \fBspc\fR(1)
156 .SH "FILES"
157 .PP
158 \fI/etc/cron\&.allow\fR, \fI/etc/cron\&.deny\fR
159 .RS 4
160 The files
161 \fI/etc/cron\&.allow\fR
162 and
163 \fI/etc/cron\&.deny\fR
164 if they exist, must be either world\-readable, or readable by group ``crontab\*(Aq\*(Aq\&. If they are not, then
165 \fBcron\fR(8)
166 will deny access to all users until the permissions are fixed\&.
167 .RE
168 .PP
169 \fI/var/spool/cron/crontabs\fR
170 .RS 4
171 There is one file for each user\*(Aqs crontab under the
172 \fI/var/spool/cron/crontabs\fR
173 directory\&. Users are not allowed to edit the files under that directory directly to ensure that only users allowed by the system to run periodic tasks can add them, and only syntactically correct crontabs will be written there\&. This is enforced by having the directory writable only by the ``crontab\*(Aq\*(Aq group and configuring
174 \fBcrontab\fR
175 command with the setgid bid set for that specific group\&.
176 .RE
177 .SH "STANDARDS"
178 .PP
179 The
180 \fBcrontab\fR
181 command conforms to IEEE Std1003\&.2\-1992 (``POSIX\*(Aq\*(Aq)\&. This new command syntax differs from previous versions of Vixie Cron, as well as from the classic SVR3 syntax\&.
182 .SH "DIAGNOSTICS"
183 .PP
184 A fairly informative usage message appears if you run it with a bad command line\&.
185 .PP
186 \fBcron\fR(8)
187 requires that each entry in a crontab end in a newline character\&. If the last entry in a crontab is missing the newline,
188 \fBcron\fR(8)
189 will consider the crontab (at least partially) broken and refuse to install it\&.
190 .PP
191 The files under
192 \fI/var/spool/cron/crontabs\fR
193 are named based on the user\*(Aqs account name\&. Crontab jobs will not be run for users whose accounts have been renamed either due to changes in the local system or because they are managed through a central user database (external to the system, for example an LDAP directory)\&.
194 .SH "AUTHORS"
195 .PP
196 \fBPaul Vixie\fR <\&paul@vix\&.com\&>
197 .RS 4
198 Wrote this manpage (1994)\&.
199 .RE
200 .PP
201 \fBSteve Greenland\fR <\&stevegr@debian\&.org\&>
202 .RS 4
203 Maintained the package (1996\-2005)\&.
204 .RE
205 .PP
206 \fBJavier Fern\('andez\-Sanguino Pe\(~na\fR <\&jfs@debian\&.org\&>
207 .RS 4
208 Maintained the package (2005\-2014)\&.
209 .RE
210 .PP
211 \fBChristian Kastner\fR <\&ckk@debian\&.org\&>
212 .RS 4
213 Maintained the package (2010\-2016)\&.
214 .RE
215 .PP
216 \fBGeorges Khaznadar\fR <\&georgesk@debian\&.org\&>
217 .RS 4
218 Maintained the package (2022\-2024)\&.
219 .RE
220 .SH "COPYRIGHT"
221 .br
222 Copyright \(co 1994 Paul Vixie
223 .br
224 .PP
225 Distribute freely, except: don\*(Aqt remove my name from the source or documentation (don\*(Aqt take credit for my work), mark your changes (don\*(Aqt get me blamed for your possible bugs), don\*(Aqt alter or remove this notice\&. May be sold if buildable source is provided to buyer\&. No warranty of any kind, express or implied, is included with this software; use at your own risk, responsibility for damages (if any) to anyone resulting from the use of this software rests entirely with the user\&.
226 .PP
227 Since year 1994, many modifications were made in this manpage, authored by Debian Developers which maintained
228 cron; above is a short list, more information can be found in the file
229 \fI/usr/share/doc/cron/copyright\fR\&.
230 .sp