xref: /netbsd-src/usr.bin/at/at.1 (revision cac73935828eae289ec76f3e2a41fc3c830c6658)
1.\" $NetBSD: at.1,v 1.29 2016/11/18 12:16:48 abhinav 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
168.Nm at
169is determined by the files
170.Pa /var/at/at.allow
171and
172.Pa /var/at/at.deny .
173.Pp
174If the file
175.Pa /var/at/at.allow
176exists, only usernames mentioned in it are allowed to use
177.Nm .
178.Pp
179If
180.Pa /var/at/at.allow
181does not exist,
182.Pa /var/at/at.deny
183is checked; every username not mentioned in it is then allowed
184to use
185.Nm .
186.Pp
187If neither exists, only the superuser is allowed use of
188.Nm .
189.Pp
190An empty
191.Pa /var/at/at.deny
192means that every user is allowed use these commands.
193This is the default configuration.
194.Sh OPTIONS
195.Bl -tag -offset indent -width XqXqueueXX
196.It Fl b
197Is an alias for
198.Nm batch .
199.It Fl c
200Cats the jobs listed on the command line to standard output.
201.It Fl d
202Is an alias for
203.Nm atrm .
204.It Fl f Ar file
205Reads the job from
206.Ar file
207rather than standard input.
208.It Fl l
209Is an alias for
210.Nm atq .
211.It Fl m
212Send mail to the user when the job has completed even if there was no
213output.
214.It Fl q Ar queue
215Uses the specified queue.
216A queue designation consists of a single letter.
217Valid queue designations
218range from
219.Sq a
220to
221.Sq z
222and
223.Sq A
224to
225.Sq Z .
226The
227.Sq c
228queue is the default for
229.Nm
230and the
231.Sq E
232queue for
233.Nm batch .
234Queues with higher letters run with increased niceness.
235If a job is submitted to a queue designated with an uppercase letter, it
236is treated as if it had been submitted to batch at that time.
237If
238.Nm atq
239is given a specific queue, it will only show jobs pending in that queue.
240.It Fl r
241Is an alias for
242.Nm atrm .
243.It Fl t
244For both
245.Nm
246and
247.Nm batch ,
248the time may be specified in a language-neutral format consisting of:
249.Bl -tag -width Ds -compact -offset indent
250.It Ar CC
251The first two digits of the year (the century).
252.It Ar YY
253The second two digits of the year.
254If
255.Ar YY
256is specified, but
257.Ar CC
258is not, a value for
259.Ar YY
260between 69 and 99 results in a
261.Ar CC
262value of 19.
263Otherwise, a
264.Ar CC
265value of 20 is used.
266.It Ar MM
267The month of the year, from 01 to 12.
268.It Ar \&DD
269The day of the month, from 01 to 31.
270.It Ar hh
271The hour of the day, from 00 to 23.
272.It Ar mm
273The minute of the hour, from 00 to 59.
274.It Ar \&SS
275The second of the minute, from 00 to 61.
276.El
277.It Fl V
278Prints the version number to standard error.
279.It Fl v
280For
281.Nm atq ,
282shows completed but not yet deleted jobs in the queue.
283Otherwise shows the time the job will be executed.
284.El
285.Sh FILES
286.Bl -tag -width /var/at/.lockfile -compact
287.It Pa /var/at/jobs
288Directory containing job files
289.It Pa /var/at/spool
290Directory containing output spool files
291.It Pa /var/run/utmp
292Login records
293.It Pa /var/at/at.allow
294Allow permission control
295.It Pa /var/at/at.deny
296Deny permission control
297.It Pa /var/at/.lockfile
298Job-creation lock file.
299.El
300.Sh SEE ALSO
301.Xr nice 1 ,
302.Xr sendmail 1 ,
303.Xr sh 1 ,
304.Xr umask 2 ,
305.Xr atrun 8 ,
306.Xr cron 8
307.Sh STANDARDS
308The
309.Nm
310and
311.Nm batch
312utilities conform to
313.St -p1003.2-92 .
314.Sh AUTHORS
315.An -nosplit
316.Nm
317was mostly written by
318.An Thomas Koenig Aq Mt ig25@rz.uni-karlsruhe.de .
319The time parsing routines are implemented by
320.An David Parsons Aq Mt orc@pell.chi.il.us .
321.Sh BUGS
322If the file
323.Pa /var/run/utmp
324is not available or corrupted, or if the user is not logged on at the
325time
326.Nm
327is invoked, the mail is sent to the userid found
328in the environment variable
329.Ev LOGNAME .
330If that is undefined or empty, the current userid is assumed.
331.Pp
332.Nm
333and
334.Nm batch
335as presently implemented are not suitable when users are competing for
336resources.
337If this is the case for your site, you might want to consider another
338batch system, such as
339.Ic nqs .
340