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