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