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