xref: /freebsd/usr.bin/at/at.man (revision 5ec37969a194a22b306948ab55c4d4cbe1ae580e)
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 \*[Px] time format (see
133.Fl t
134option).
135.Pp
136For both
137.Nm
138and
139.Nm batch ,
140commands are read from standard input or the file specified
141with the
142.Fl f
143option and executed.
144The working directory, the environment (except for the variables
145.Ev TERM ,
146.Ev TERMCAP ,
147.Ev DISPLAY
148and
149.Em _ )
150and the
151.Ar umask
152are retained from the time of invocation.
153An
154.Nm
155or
156.Nm batch
157command invoked from a
158.Xr su 1
159shell will retain the current userid.
160The user will be mailed standard error and standard output from his
161commands, if any.
162Mail will be sent using the command
163.Xr sendmail 8 .
164If
165.Nm
166is executed from a
167.Xr su 1
168shell, the owner of the login shell will receive the mail.
169.Pp
170The superuser may use these commands in any case.
171For other users, permission to use
172.Nm
173is determined by the files
174.Pa _PERM_PATH/at.allow
175and
176.Pa _PERM_PATH/at.deny .
177.Pp
178If the file
179.Pa _PERM_PATH/at.allow
180exists, only usernames mentioned in it are allowed to use
181.Nm .
182.Pp
183If
184.Pa _PERM_PATH/at.allow
185does not exist,
186.Pa _PERM_PATH/at.deny
187is checked, every username not mentioned in it is then allowed
188to use
189.Nm Ns .
190.Pp
191If neither exists, only the superuser is allowed use of
192.Nm Ns .
193This is the default configuration.
194.Sh IMPLEMENTATION NOTES
195Note that
196.Nm
197is implemented through the
198.Xr cron 8
199daemon by calling
200.Xr atrun 8
201every five minutes.
202This implies that the granularity of
203.Nm
204might not be optimal for every deployment.
205If a finer granularity is needed, the system crontab at
206.Pa /etc/crontab
207needs to be changed.
208.Sh OPTIONS
209.Bl -tag -width indent
210.It Fl q Ar queue
211Use the specified queue.
212A queue designation consists of a single letter; valid queue designations
213range from
214.Ar a
215to
216.Ar z
217and
218.Ar A
219to
220.Ar Z .
221The
222.Ar _DEFAULT_AT_QUEUE
223queue is the default for
224.Nm
225and the
226.Ar _DEFAULT_BATCH_QUEUE
227queue for
228.Nm batch .
229Queues with higher letters run with increased niceness.
230If a job is submitted to a queue designated with an uppercase letter, it
231is treated as if it had been submitted to batch at that time.
232If
233.Nm atq
234is given a specific queue, it will only show jobs pending in that queue.
235.It Fl m
236Send mail to the user when the job has completed even if there was no
237output.
238.It Fl f Ar file
239Read the job from
240.Ar file
241rather than standard input.
242.It Fl l
243With no arguments, list all jobs for the invoking user.
244If one or more
245job numbers are given, list only those jobs.
246.It Fl d
247Is an alias for
248.Nm atrm
249(this option is deprecated; use
250.Fl r
251instead).
252.It Fl b
253Is an alias for
254.Nm batch .
255.It Fl v
256For
257.Nm atq ,
258shows completed but not yet deleted jobs in the queue; otherwise
259shows the time the job will be executed.
260.It Fl c
261Cat the jobs listed on the command line to standard output.
262.It Fl r
263Remove the specified jobs.
264.It Fl t
265Specify the job time using the \*[Px] time format.
266The argument should be in the form
267.Sm off
268.Op Oo Ar CC Oc Ar YY
269.Ar MM DD hh mm Op . Ar SS
270.Sm on
271where each pair of letters represents the following:
272.Pp
273.Bl -tag -width indent -compact -offset indent
274.It Ar CC
275The first two digits of the year (the century).
276.It Ar YY
277The second two digits of the year.
278.It Ar MM
279The month of the year, from 1 to 12.
280.It Ar DD
281the day of the month, from 1 to 31.
282.It Ar hh
283The hour of the day, from 0 to 23.
284.It Ar mm
285The minute of the hour, from 0 to 59.
286.It Ar SS
287The second of the minute, from 0 to 61.
288.El
289.Pp
290If the
291.Ar CC
292and
293.Ar YY
294letter pairs are not specified, the values default to the current
295year.
296If the
297.Ar SS
298letter pair is not specified, the value defaults to 0.
299.El
300.Sh FILES
301.Bl -tag -width _ATJOB_DIR/_LOCKFILE -compact
302.It Pa _ATJOB_DIR
303directory containing job files
304.It Pa _ATSPOOL_DIR
305directory containing output spool files
306.It Pa /var/run/utmp
307login records
308.It Pa _PERM_PATH/at.allow
309allow permission control
310.It Pa _PERM_PATH/at.deny
311deny permission control
312.It Pa _ATJOB_DIR/_LOCKFILE
313job-creation lock file
314.El
315.Sh SEE ALSO
316.Xr nice 1 ,
317.Xr sh 1 ,
318.Xr umask 2 ,
319.Xr atrun 8 ,
320.Xr cron 8 ,
321.Xr sendmail 8
322.Sh BUGS
323If the file
324.Pa /var/run/utmp
325is not available or corrupted, or if the user is not logged on at the
326time
327.Nm
328is invoked, the mail is sent to the userid found
329in the environment variable
330.Ev LOGNAME .
331If that is undefined or empty, the current userid is assumed.
332.Pp
333.Nm \&At
334and
335.Nm batch
336as presently implemented are not suitable when users are competing for
337resources.
338If this is the case, another batch system such as
339.Em nqs
340may be more suitable.
341.Pp
342Specifying a date past 2038 may not work on some systems.
343.Sh AUTHORS
344At was mostly written by
345.An Thomas Koenig Aq ig25@rz.uni-karlsruhe.de .
346The time parsing routines are by
347.An David Parsons Aq orc@pell.chi.il.us ,
348with minor enhancements by
349.An Joe Halpin Aq joe.halpin@attbi.com .
350