]> git.saurik.com Git - apple/system_cmds.git/blob - at.tproj/at.man
5cd496000c9e751bffb8bf9f4ce864343ccdc9f0
[apple/system_cmds.git] / at.tproj / at.man
1 .\" $FreeBSD: src/usr.bin/at/at.man,v 1.34 2003/03/26 02:38:18 keramida Exp $
2 .Dd January 13, 2002
3 .Dt "AT" 1
4 .Os
5 .Sh NAME
6 .Nm at ,
7 .Nm batch ,
8 .Nm atq ,
9 .Nm atrm
10 .Nd queue, examine, or delete jobs for later execution
11 .Sh SYNOPSIS
12 .Nm at
13 .Op Fl q Ar queue
14 .Op Fl f Ar file
15 .Op Fl mldbv
16 .Ar time
17 .Nm at
18 .Op Fl q Ar queue
19 .Op Fl f Ar file
20 .Op Fl mldbv
21 .Fl t
22 .Sm off
23 .Op Oo Ar CC Oc Ar YY
24 .Ar MM DD hh mm Op . Ar SS
25 .Sm on
26 .Nm at
27 .Fl c Ar job Op Ar job ...
28 .Nm at
29 .Fl l Op Ar job ...
30 .Nm at
31 .Fl l
32 .Fl q Ar queue
33 .Nm at
34 .Fl r Ar job Op Ar job ...
35 .Pp
36 .Nm atq
37 .Op Fl q Ar queue
38 .Op Fl v
39 .Pp
40 .Nm atrm
41 .Ar job
42 .Op Ar job ...
43 .Pp
44 .Nm batch
45 .Op Fl q Ar queue
46 .Op Fl f Ar file
47 .Op Fl mv
48 .Op Ar time
49 .Sh DESCRIPTION
50 The
51 .Nm at
52 and
53 .Nm batch
54 utilities
55 read commands from standard input or a specified file.
56 The commands are executed at a later time, using
57 .Xr sh 1 .
58 .Bl -tag -width indent
59 .It Nm at
60 executes commands at a specified time;
61 .It Nm atq
62 lists the user's pending jobs, unless the user is the superuser; in that
63 case, everybody's jobs are listed;
64 .It Nm atrm
65 deletes jobs;
66 .It Nm batch
67 executes commands when system load levels permit; in other words, when the load average
68 drops below _LOADAVG_MX, or the value specified in the invocation of
69 .Nm atrun .
70 .El
71 .Pp
72 The
73 .Nm at
74 utility allows some moderately complex
75 .Ar time
76 specifications.
77 It accepts times of the form
78 .Ar HHMM
79 or
80 .Ar HH:MM
81 to run a job at a specific time of day.
82 (If that time is already past, the next day is assumed.)
83 As an alternative, the following keywords may be specified:
84 .Em midnight ,
85 .Em noon ,
86 or
87 .Em teatime
88 (4pm)
89 and time-of-day may be suffixed with
90 .Em AM
91 or
92 .Em PM
93 for running in the morning or the evening.
94 The day on which the job is to be run may also be specified
95 by giving a date in the form
96 .Ar \%month-name day
97 with an optional
98 .Ar year ,
99 or giving a date of the forms
100 .Ar DD.MM.YYYY ,
101 .Ar DD.MM.YY ,
102 .Ar MM/DD/YYYY ,
103 .Ar MM/DD/YY ,
104 .Ar MMDDYYYY , or
105 .Ar MMDDYY .
106 The specification of a date must follow the specification of
107 the time of day.
108 Time can also be specified as:
109 .Op Em now
110 .Em + Ar count \%time-units ,
111 where the time-units can be
112 .Em minutes ,
113 .Em hours ,
114 .Em days ,
115 .Em weeks ,
116 .Em months
117 or
118 .Em years
119 and
120 .Nm at
121 may be told to run the job today by suffixing the time with
122 .Em today
123 and to run the job tomorrow by suffixing the time with
124 .Em tomorrow .
125 .Pp
126 For example, to run a job at 4pm three days from now, use
127 .Nm at Ar 4pm + 3 days ,
128 to run a job at 10:00am on July 31, use
129 .Nm at Ar 10am Jul 31
130 and to run a job at 1am tomorrow, use
131 .Nm at Ar 1am tomorrow .
132 .Pp
133 The
134 .Nm at
135 utility also supports the
136 .Tn POSIX
137 time format (see
138 .Fl t
139 option).
140 .Pp
141 For both
142 .Nm at
143 and
144 .Nm batch ,
145 commands are read from standard input or the file specified
146 with the
147 .Fl f
148 option.
149 The working directory, the environment (except for the variables
150 .Ev TERM ,
151 .Ev TERMCAP ,
152 .Ev DISPLAY
153 and
154 .Em _ ) ,
155 and the
156 .Ar umask
157 are retained from the time of invocation.
158 An
159 .Nm at
160 or
161 .Nm batch
162 command invoked from a
163 .Xr su 1
164 shell will retain the current userid.
165 The user will be mailed standard error and standard output from his
166 commands, if any.
167 Mail will be sent using the command
168 .Xr sendmail 8 .
169 If
170 .Nm at
171 is executed from a
172 .Xr su 1
173 shell, the owner of the login shell will receive the mail.
174 .Pp
175 The superuser may use these commands in any case.
176 For other users, permission to use
177 .Nm at
178 is determined by the files
179 .Pa _PERM_PATH/at.allow
180 and
181 .Pa _PERM_PATH/at.deny .
182 .Pp
183 If the file
184 .Pa _PERM_PATH/at.allow
185 exists, only usernames mentioned in it are allowed to use
186 .Nm at .
187 In these two files,
188 a user is considered to be listed
189 only if the user name has no blank or other characters
190 before it on its line and a newline character immediately after the name,
191 even at the end of the file.
192 Other lines are ignored and may be used for comments.
193 .Pp
194 If
195 .Pa _PERM_PATH/at.allow
196 does not exist,
197 .Pa _PERM_PATH/at.deny
198 is checked, every username not mentioned in it is then allowed
199 to use
200 .Nm at .
201 .Pp
202 If neither exists, only the superuser is allowed use of
203 .Nm at .
204 This is the default configuration.
205 .Sh IMPLEMENTATION NOTES
206 Note that
207 .Nm at
208 is implemented through the
209 .Xr cron 8
210 daemon by calling
211 .Xr atrun 8
212 every five minutes.
213 This implies that the granularity of
214 .Nm at
215 might not be optimal for every deployment.
216 If a finer granularity is needed, the system crontab at
217 .Pa /etc/crontab
218 needs to be changed.
219 .Sh OPTIONS
220 .Bl -tag -width indent
221 .\" ==========
222 .It Fl b
223 Is an alias for
224 .Nm batch .
225 .\" ==========
226 .It Fl c
227 Cat the jobs listed on the command line to standard output.
228 .\" ==========
229 .It Fl d
230 Is an alias for
231 .Nm atrm
232 (this option is deprecated; use
233 .Fl r
234 instead).
235 .\" ==========
236 .It Fl f Ar file
237 Read the job from
238 .Ar file
239 rather than standard input.
240 .\" ==========
241 .It Fl l
242 With no arguments, list all jobs for the invoking user.
243 If one or more
244 job numbers are given, list only those jobs.
245 .\" ==========
246 .It Fl m
247 Send mail to the user when the job has completed even if there was no
248 output.
249 .\" ==========
250 .It Fl q Ar queue
251 Use the specified queue.
252 A queue designation consists of a single letter; valid queue designations
253 range from
254 .Ar a
255 to
256 .Ar z
257 and
258 .Ar A
259 to
260 .Ar Z .
261 The
262 .Ar _DEFAULT_AT_QUEUE
263 queue (a) is the default for
264 .Nm at
265 and the
266 .Ar _DEFAULT_BATCH_QUEUE
267 queue (b) is the default for
268 .Nm batch .
269 Queues with higher letters run with increased niceness.
270 If a job is submitted to a queue designated with an uppercase letter, it
271 is treated as if it had been submitted to batch at that time.
272 If
273 .Nm atq
274 is given a specific queue, it will only show jobs pending in that queue.
275 .\" ==========
276 .It Fl r
277 Remove the specified jobs.
278 .\" ==========
279 .It Fl t
280 Specify the job time using the \*[Px] time format.
281 The argument should be in the form
282 .Sm off
283 .Op Oo Ar CC Oc Ar YY
284 .Ar MM DD hh mm Op . Ar SS
285 .Sm on
286 where each pair of letters represents the following:
287 .Pp
288 .Bl -tag -width indent -compact -offset indent
289 .\" ==========
290 .It Ar CC
291 The first two digits of the year (the century).
292 .\" ==========
293 .It Ar YY
294 The second two digits of the year.
295 .\" ==========
296 .It Ar MM
297 The month of the year, from 1 to 12.
298 .\" ==========
299 .It Ar DD
300 the day of the month, from 1 to 31.
301 .\" ==========
302 .It Ar hh
303 The hour of the day, from 0 to 23.
304 .\" ==========
305 .It Ar mm
306 The minute of the hour, from 0 to 59.
307 .\" ==========
308 .It Ar SS
309 The second of the minute, from 0 to 61.
310 .El
311 .Pp
312 If the
313 .Ar CC
314 and
315 .Ar YY
316 letter pairs are not specified, the values default to the current
317 year.
318 If the
319 .Ar SS
320 letter pair is not specified, the value defaults to 0.
321 .\" ==========
322 .It Fl v
323 For
324 .Nm atq ,
325 shows completed but not yet deleted jobs in the queue; otherwise
326 shows the time the job will be executed.
327 .El
328 .Sh FILES
329 .Bl -tag -width _ATJOB_DIR/_LOCKFILE -compact
330 .\" ==========
331 .It Pa _ATJOB_DIR
332 directory containing job files
333 (/usr/lib/cron/jobs/)
334 .\" ==========
335 .It Pa _ATJOB_DIR/_LOCKFILE
336 job-creation lock file
337 (/usr/lib/cron/jobs/...)
338 .\" ==========
339 .It Pa _ATSPOOL_DIR
340 directory containing output spool files
341 (/usr/lib/cron/spool/)
342 .\" ==========
343 .It Pa _PERM_PATH/at.allow
344 allow permission control
345 (/usr/lib/cron/at.allow)
346 .\" ==========
347 .It Pa _PERM_PATH/at.deny
348 deny permission control
349 (/usr/lib/cron/at.deny)
350 .It Pa /var/run/utmpx
351 login records
352 .El
353 .Sh SEE ALSO
354 .Xr nice 1 ,
355 .Xr sh 1 ,
356 .Xr umask 2 ,
357 .Xr compat 5 ,
358 .Xr atrun 8 ,
359 .Xr cron 8 ,
360 .Xr sendmail 8
361 .Sh BUGS
362 If the file
363 .Pa /var/run/utmpx
364 is not available or corrupted,
365 or if the user is not logged on at the time
366 .Nm at
367 is invoked, the mail is sent to the userid found
368 in the environment variable
369 .Ev LOGNAME .
370 If that is undefined or empty, the current userid is assumed.
371 .Pp
372 The
373 .Nm at
374 and
375 .Nm batch
376 utilities
377 as presently implemented are not suitable when users are competing for
378 resources.
379 If this is the case, another batch system such as
380 .Em nqs
381 may be more suitable.
382 .Pp
383 Specifying a date past 2038 may not work on some systems.
384 .Sh AUTHORS
385 At was mostly written by
386 .An Thomas Koenig Aq ig25@rz.uni-karlsruhe.de .
387 The time parsing routines are by
388 .An David Parsons Aq orc@pell.chi.il.us ,
389 with minor enhancements by
390 .An Joe Halpin Aq joe.halpin@attbi.com .