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