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