1at(1) User Commands at(1)
2
3
4
6 at, batch - execute commands at a later time
7
9 /usr/bin/at [-c | -k | -s] [-m] [-f file] [-p project]
10 [-q queuename] -t time
11
12
13 /usr/bin/at [-c | -k | -s] [-m] [-f file] [-p project]
14 [-q queuename] timespec...
15
16
17 /usr/bin/at -l [-p project] [-q queuename] [at_job_id. ..]
18
19
20 /usr/bin/at -r at_job_id. ..
21
22
23 /usr/bin/batch [-p project]
24
25
26 /usr/xpg4/bin/at [-c | -k | -s] [-m] [-f file] [-p project]
27 [-q queuename] -t time
28
29
30 /usr/xpg4/bin/at [-c | -k | -s] [-m] [-f file] [-p project]
31 [-q queuename] timespec...
32
33
34 /usr/xpg4/bin/at -l [-p project] [-q queuename]
35 [at_job_id. ..]
36
37
38 /usr/xpg4/bin/at -r at_job_id. ..
39
40
41 /usr/xpg4/bin/batch [-p project]
42
43
45 at
46 The at utility reads commands from standard input and groups them
47 together as an at-job, to be executed at a later time.
48
49
50 The at-job is executed in a separate invocation of the shell, running
51 in a separate process group with no controlling terminal, except that
52 the environment variables, current working directory, file creation
53 mask (see umask(1)), and system resource limits (for sh and ksh only,
54 see ulimit(1)) in effect when the at utility is executed is retained
55 and used when the at-job is executed.
56
57
58 When the at-job is submitted, the at_job_id and scheduled time are
59 written to standard error. The at_job_id is an identifier that is a
60 string consisting solely of alphanumeric characters and the period
61 character. The at_job_id is assigned by the system when the job is
62 scheduled such that it uniquely identifies a particular job.
63
64
65 User notification and the processing of the job's standard output and
66 standard error are described under the -m option.
67
68
69 Users are permitted to use at and batch (see below) if their name
70 appears in the file /usr/lib/cron/at.allow. If that file does not
71 exist, the file /usr/lib/cron/at.deny is checked to determine if the
72 user should be denied access to at. If neither file exists, only a user
73 with the solaris.jobs.user authorization is allowed to submit a job. If
74 only at.deny exists and is empty, global usage is permitted. The
75 at.allow and at.deny files consist of one user name per line.
76
77
78 cron and at jobs are not be executed if the user's account is locked.
79 Only accounts which are not locked as defined in shadow(4) will have
80 their job or process executed.
81
82 batch
83 The batch utility reads commands to be executed at a later time.
84
85
86 Commands of the forms:
87
88 /usr/bin/batch [-p project]
89 /usr/xpg4/bin/batch [-p project]
90
91
92
93
94 are respectively equivalent to:
95
96 /usr/bin/at -q b [-p project] now
97 /usr/xpg4/bin/at -q b -m [-p project] now
98
99
100
101
102 where queue b is a special at queue, specifically for batch jobs. Batch
103 jobs are submitted to the batch queue for immediate execution. Execu‐
104 tion of submitted jobs can be delayed by limits on the number of jobs
105 allowed to run concurrently. See queuedefs(4).
106
108 If the -c, -k, or -s options are not specified, the SHELL environment
109 variable by default determines which shell to use.
110
111
112 For /usr/xpg4/bin/at and /usr/xpg4/bin/batch, if SHELL is unset or
113 NULL, /usr/xpg4/bin/sh is used.
114
115
116 For usr/bin/at and /usr/bin/batch, if SHELL is unset or NULL, /bin/sh
117 is used.
118
119
120 The following options are supported:
121
122 -c C shell. csh(1) is used to execute the at-job.
123
124
125 -k Korn shell. ksh(1) is used to execute the at-job.
126
127
128 -s Bourne shell. sh(1) is used to execute the at-job.
129
130
131 -f file Specifies the path of a file to be used as the source
132 of the at-job, instead of standard input.
133
134
135 -l (The letter ell.) Reports all jobs scheduled for the
136 invoking user if no at_job_id operands are specified.
137 If at_job_ids are specified, reports only information
138 for these jobs.
139
140
141 -m Sends mail to the invoking user after the at-job has
142 run, announcing its completion. Standard output and
143 standard error produced by the at-job are mailed to
144 the user as well, unless redirected elsewhere. Mail is
145 sent even if the job produces no output.
146
147 If -m is not used, the job's standard output and stan‐
148 dard error is provided to the user by means of mail,
149 unless they are redirected elsewhere; if there is no
150 such output to provide, the user is not notified of
151 the job's completion.
152
153
154 -p project Specifies under which project the at or batch job is
155 run. When used with the -l option, limits the search
156 to that particular project. Values for project is
157 interpreted first as a project name, and then as a
158 possible project ID, if entirely numeric. By default,
159 the user's current project is used.
160
161
162 -q queuename Specifies in which queue to schedule a job for submis‐
163 sion. When used with the -l option, limits the search
164 to that particular queue. Values for queuename are
165 limited to the lower case letters a through z. By
166 default, at-jobs are scheduled in queue a. In con‐
167 trast, queue b is reserved for batch jobs. Since queue
168 c is reserved for cron jobs, it can not be used with
169 the -q option.
170
171
172 -r at_job_id Removes the jobs with the specified at_job_id operands
173 that were previously scheduled by the at utility.
174
175
176 -t time Submits the job to be run at the time specified by the
177 time option-argument, which must have the format as
178 specified by the touch(1) utility.
179
180
182 The following operands are supported:
183
184 at_job_id The name reported by a previous invocation of the at
185 utility at the time the job was scheduled.
186
187
188 timespec Submit the job to be run at the date and time specified.
189 All of the timespec operands are interpreted as if they
190 were separated by space characters and concatenated. The
191 date and time are interpreted as being in the timezone of
192 the user (as determined by the TZ variable), unless a
193 timezone name appears as part of time below.
194
195 In the "C" locale, the following describes the three
196 parts of the time specification string. All of the values
197 from the LC_TIME categories in the "C" locale are recog‐
198 nized in a case-insensitive manner.
199
200 time The time can be specified as one, two or
201 four digits. One- and two-digit numbers are
202 taken to be hours, four-digit numbers to be
203 hours and minutes. The time can alterna‐
204 tively be specified as two numbers sepa‐
205 rated by a colon, meaning hour:minute. An
206 AM/PM indication (one of the values from
207 the am_pm keywords in the LC_TIME locale
208 category) can follow the time; otherwise, a
209 24-hour clock time is understood. A time‐
210 zone name of GMT, UCT, or ZULU (case insen‐
211 sitive) can follow to specify that the time
212 is in Coordinated Universal Time. Other
213 timezones can be specified using the TZ
214 environment variable. The time field can
215 also be one of the following tokens in the
216 "C" locale:
217
218 midnight Indicates the time 12:00 am
219 (00:00).
220
221
222 noon Indicates the time 12:00 pm.
223
224
225 now Indicate the current day and
226 time. Invoking at now submits
227 an at-job for potentially
228 immediate execution (that is,
229 subject only to unspecified
230 scheduling delays).
231
232
233
234 date An optional date can be specified as either
235 a month name (one of the values from the
236 mon or abmon keywords in the LC_TIME locale
237 category) followed by a day number (and
238 possibly year number preceded by a comma)
239 or a day of the week (one of the values
240 from the day or abday keywords in the
241 LC_TIME locale category). Two special days
242 are recognized in the "C" locale:
243
244 today Indicates the current day.
245
246
247 tomorrow Indicates the day following
248 the current day.
249
250 If no date is given, today is assumed if
251 the given time is greater than the current
252 time, and tomorrow is assumed if it is
253 less. If the given month is less than the
254 current month (and no year is given), next
255 year is assumed.
256
257
258 increment The optional increment is a number preceded
259 by a plus sign (+) and suffixed by one of
260 the following: minutes, hours, days, weeks,
261 months, or years. (The singular forms are
262 also accepted.) The keyword next is equiva‐
263 lent to an increment number of + 1. For
264 example, the following are equivalent com‐
265 mands:
266
267 at 2pm + 1 week
268 at 2pm next week
269
270
271
272
273
275 The format of the at command line shown here is guaranteed only for the
276 "C" locale. Other locales are not supported for midnight, noon, now,
277 mon, abmon, day, abday, today, tomorrow, minutes, hours, days, weeks,
278 months, years, and next.
279
280
281 Since the commands run in a separate shell invocation, running in a
282 separate process group with no controlling terminal, open file descrip‐
283 tors, traps and priority inherited from the invoking environment are
284 lost.
285
287 at
288 Example 1 Typical Sequence at a Terminal
289
290
291 This sequence can be used at a terminal:
292
293
294 $ at −m 0730 tomorrow
295 sort < file >outfile
296 <EOT>
297
298
299
300 Example 2 Redirecting Output
301
302
303 This sequence, which demonstrates redirecting standard error to a pipe,
304 is useful in a command procedure (the sequence of output redirection
305 specifications is significant):
306
307
308 $ at now + 1 hour <<!
309 diff file1 file2 2>&1 >outfile | mailx mygroup
310
311
312
313 Example 3 Self-rescheduling a Job
314
315
316 To have a job reschedule itself, at can be invoked from within the at-
317 job. For example, this "daily-processing" script named my.daily runs
318 every day (although crontab is a more appropriate vehicle for such
319 work):
320
321
322 # my.daily runs every day
323 at now tomorrow < my.daily
324 daily-processing
325
326
327
328 Example 4 Various Time and Operand Presentations
329
330
331 The spacing of the three portions of the "C" locale timespec is quite
332 flexible as long as there are no ambiguities. Examples of various times
333 and operand presentations include:
334
335
336 at 0815am Jan 24
337 at 8 :15amjan24
338 at now "+ 1day"
339 at 5 pm FRIday
340 at '17
341 utc+
342 30minutes'
343
344
345
346 batch
347 Example 5 Typical Sequence at a Terminal
348
349
350 This sequence can be used at a terminal:
351
352
353 $ batch
354 sort <file >outfile
355 <EOT>
356
357
358
359 Example 6 Redirecting Output
360
361
362 This sequence, which demonstrates redirecting standard error to a pipe,
363 is useful in a command procedure (the sequence of output redirection
364 specifications is significant):
365
366
367 $ batch <<!
368 diff file1 file2 2>&1 >outfile | mailx mygroup
369 !
370
371
372
374 See environ(5) for descriptions of the following environment variables
375 that affect the execution of at and batch: LANG, LC_ALL, LC_CTYPE,
376 LC_MESSAGES, NLSPATH, and LC_TIME.
377
378 DATEMSK If the environment variable DATEMSK is set, at uses its
379 value as the full path name of a template file containing
380 format strings. The strings consist of format specifiers
381 and text characters that are used to provide a richer set
382 of allowable date formats in different languages by appro‐
383 priate settings of the environment variable LANG or
384 LC_TIME. The list of allowable format specifiers is located
385 in the getdate(3C) manual page. The formats described in
386 the OPERANDS section for the time and date arguments, the
387 special names noon, midnight, now, next, today, tomorrow,
388 and the increment argument are not recognized when DATEMSK
389 is set.
390
391
392 SHELL Determine a name of a command interpreter to be used to
393 invoke the at-job. If the variable is unset or NULL, sh is
394 used. If it is set to a value other than sh, the implemen‐
395 tation uses that shell; a warning diagnostic is printed
396 telling which shell will be used.
397
398
399 TZ Determine the timezone. The job is submitted for execution
400 at the time specified by timespec or -t time relative to
401 the timezone specified by the TZ variable. If timespec
402 specifies a timezone, it overrides TZ. If timespec does not
403 specify a timezone and TZ is unset or NULL, an unspecified
404 default timezone is used.
405
406
408 The following exit values are returned:
409
410 0 The at utility successfully submitted, removed or listed a job
411 or jobs.
412
413
414 >0 An error occurred, and the job will not be scheduled.
415
416
418 /usr/lib/cron/at.allow names of users, one per line, who are autho‐
419 rized access to the at and batch utilities
420
421
422 /usr/lib/cron/at.deny names of users, one per line, who are denied
423 access to the at and batch utilities
424
425
427 See attributes(5) for descriptions of the following attributes:
428
429 /usr/bin/at
430 ┌─────────────────────────────┬─────────────────────────────┐
431 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
432 ├─────────────────────────────┼─────────────────────────────┤
433 │Availability │SUNWcsu │
434 ├─────────────────────────────┼─────────────────────────────┤
435 │CSI │Not enabled │
436 ├─────────────────────────────┼─────────────────────────────┤
437 │Interface Stability │Standard │
438 └─────────────────────────────┴─────────────────────────────┘
439
440 /usr/xpg4/bin/at
441 ┌─────────────────────────────┬─────────────────────────────┐
442 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
443 ├─────────────────────────────┼─────────────────────────────┤
444 │Availability │SUNWxcu4 │
445 ├─────────────────────────────┼─────────────────────────────┤
446 │CSI │Not enabled │
447 ├─────────────────────────────┼─────────────────────────────┤
448 │Interface Stability │Standard │
449 └─────────────────────────────┴─────────────────────────────┘
450
451 /usr/bin/batch
452 ┌─────────────────────────────┬─────────────────────────────┐
453 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
454 ├─────────────────────────────┼─────────────────────────────┤
455 │Availability │SUNWesu │
456 ├─────────────────────────────┼─────────────────────────────┤
457 │CSI │Enabled │
458 ├─────────────────────────────┼─────────────────────────────┤
459 │Interface Stability │Standard │
460 └─────────────────────────────┴─────────────────────────────┘
461
462 /usr/xpg4/bin/batch
463 ┌─────────────────────────────┬─────────────────────────────┐
464 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
465 ├─────────────────────────────┼─────────────────────────────┤
466 │Availability │SUNWxcu4 │
467 ├─────────────────────────────┼─────────────────────────────┤
468 │CSI │Enabled │
469 ├─────────────────────────────┼─────────────────────────────┤
470 │Interface Stability │Standard │
471 └─────────────────────────────┴─────────────────────────────┘
472
474 auths(1), crontab(1), csh(1), date(1), ksh(1), sh(1), touch(1),
475 ulimit(1), umask(1), cron(1M), getdate(3C), auth_attr(4), shadow(4),
476 queuedefs(4), attributes(5), environ(5), standards(5)
477
479 Regardless of queue used, cron(1M) has a limit of 100 jobs in execution
480 at any time.
481
482
483 There can be delays in cron at job execution. In some cases, these
484 delays can compound to the point that cron job processing appears to be
485 hung. All jobs are executed eventually. When the delays are excessive,
486 the only workaround is to kill and restart cron.
487
488
489
490SunOS 5.11 13 Apr 2005 at(1)