xref: /netbsd-src/usr.bin/at/at.1 (revision 8b0f9554ff8762542c4defc4f70e1eb76fb508fa)
1.\" $NetBSD: at.1,v 1.22 2007/03/12 21:28:48 mlelstv 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 July 9, 2004
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 ,
109or
110.Sq weeks
111and you can tell
112.Nm
113to run the job today by suffixing the time with
114.Sq today
115and to run the job tomorrow by suffixing the time with
116.Sq tomorrow .
117.Pp
118For example, to run a job at 4pm three days from now, you would do
119.Dl at 4pm + 3 days ,
120to run a job at 10:00am on July 31, you would do
121.Dl at 10am Jul 31
122and to run a job at 1am tomorrow, you would do
123.Dl at 1am tomorrow .
124.Pp
125Alternatively the time may be specified in a language-neutral fashion
126by using the
127.Fl t
128options.
129.Pp
130For both
131.Nm
132and
133.Nm batch ,
134commands are read from standard input or the file specified
135with the
136.Fl f
137option and executed.
138The working directory, the environment (except for the variables
139.Ev TERM ,
140.Ev TERMCAP ,
141.Ev DISPLAY
142and
143.Ev _ )
144and the
145.Ar umask
146are retained from the time of invocation.
147An
148.Nm
149or
150.Nm batch
151command invoked from a
152.Xr su 1
153shell will retain the current userid.
154The user will be mailed standard error and standard output from his
155commands, if any.
156Mail will be sent using the command
157.Xr sendmail 8 .
158If
159.Nm
160is executed from a
161.Xr su 1
162shell, the owner of the login shell will receive the mail.
163.Pp
164The superuser may use these commands in any case.
165For other users, permission to use at is determined by the files
166.Pa /var/at/at.allow
167and
168.Pa /var/at/at.deny .
169.Pp
170If the file
171.Pa /var/at/at.allow
172exists, only usernames mentioned in it are allowed to use
173.Nm .
174.Pp
175If
176.Pa /var/at/at.allow
177does not exist,
178.Pa /var/at/at.deny
179is checked, every username not mentioned in it is then allowed
180to use
181.Nm .
182.Pp
183If neither exists, only the superuser is allowed use of
184.Nm .
185.Pp
186An empty
187.Pa /var/at/at.deny
188means that every user is allowed use these commands.
189This is the default configuration.
190.Sh OPTIONS
191.Bl -tag -offset indent -width XqXqueueXX
192.It Fl b
193Is an alias for
194.Nm batch .
195.It Fl c
196Cats the jobs listed on the command line to standard output.
197.It Fl d
198Is an alias for
199.Nm atrm .
200.It Fl f Ar file
201Reads the job from
202.Ar file
203rather than standard input.
204.It Fl l
205Is an alias for
206.Nm atq .
207.It Fl m
208Send mail to the user when the job has completed even if there was no
209output.
210.It Fl q Ar queue
211Uses the specified queue.
212A queue designation consists of a single letter.
213Valid queue designations
214range from
215.Sq a
216to
217.Sq z
218and
219.Sq A
220to
221.Sq Z .
222The
223.Sq c
224queue is the default for
225.Nm
226and the
227.Sq E
228queue for
229.Nm batch .
230Queues with higher letters run with increased niceness.
231If a job is submitted to a queue designated with an uppercase letter, it
232is treated as if it had been submitted to batch at that time.
233If
234.Nm atq
235is given a specific queue, it will only show jobs pending in that queue.
236.It Fl r
237Is an alias for
238.Nm atrm .
239.It Fl t
240For both
241.Nm
242and
243.Nm batch ,
244the time may be specified in a language-neutral format consisting of:
245.Bl -tag -width Ds -compact -offset indent
246.It Ar CC
247The first two digits of the year (the century).
248.It Ar YY
249The second two digits of the year.
250If
251.Ar YY
252is specified, but
253.Ar CC
254is not, a value for
255.Ar YY
256between 69 and 99 results in a
257.Ar CC
258value of 19.
259Otherwise, a
260.Ar CC
261value of 20 is used.
262.It Ar MM
263The month of the year, from 01 to 12.
264.It Ar DD
265The day of the month, from 01 to 31.
266.It Ar hh
267The hour of the day, from 00 to 23.
268.It Ar mm
269The minute of the hour, from 00 to 59.
270.It Ar SS
271The second of the minute, from 00 to 61.
272.El
273.It Fl V
274Prints the version number to standard error.
275.It Fl v
276For
277.Nm atq ,
278shows completed but not yet deleted jobs in the queue.
279Otherwise shows the time the job will be executed.
280.El
281.Sh FILES
282.Bl -tag -width /var/at/.lockfile -compact
283.It Pa /var/at/jobs
284Directory containing job files
285.It Pa /var/at/spool
286Directory containing output spool files
287.It Pa /var/run/utmp
288Login records
289.It Pa /var/at/at.allow
290Allow permission control
291.It Pa /var/at/at.deny
292Deny permission control
293.It Pa /var/at/.lockfile
294Job-creation lock file.
295.El
296.Sh SEE ALSO
297.Xr nice 1 ,
298.Xr sh 1 ,
299.Xr umask 2 ,
300.Xr atrun 8 ,
301.Xr cron 8 ,
302.Xr sendmail 8
303.Sh STANDARDS
304The
305.Nm
306and
307.Nm batch
308utilities conform to
309.St -p1003.2-92 .
310.Sh AUTHORS
311At was mostly written by Thomas Koenig \*[Lt]ig25@rz.uni-karlsruhe.de\*[Gt].
312The time parsing routines are by David Parsons \*[Lt]orc@pell.chi.il.us\*[Gt].
313.Sh BUGS
314If the file
315.Pa /var/run/utmp
316is not available or corrupted, or if the user is not logged on at the
317time
318.Nm
319is invoked, the mail is sent to the userid found
320in the environment variable
321.Ev LOGNAME .
322If that is undefined or empty, the current userid is assumed.
323.Pp
324.Nm
325and
326.Nm batch
327as presently implemented are not suitable when users are competing for
328resources.
329If this is the case for your site, you might want to consider another
330batch system, such as
331.Ic nqs .
332