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