2 .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
3 .\" Copyright 1989 AT&T
4 .\" Portions Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved
5 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
6 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
8 .\" This notice shall appear on any product containing this material.
9 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
10 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
11 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
12 .TH AT 1 "Apr 13, 2005"
14 at, batch \- execute commands at a later time
18 \fB/usr/bin/at\fR [\fB-c\fR | \fB-k\fR | \fB-s\fR] [\fB-m\fR] [\fB-f\fR \fIfile\fR] [\fB-p\fR \fIproject\fR]
19 [\fB-q\fR \fIqueuename\fR] \fB-t\fR \fItime\fR
24 \fB/usr/bin/at\fR [\fB-c\fR | \fB-k\fR | \fB-s\fR] [\fB-m\fR] [\fB-f\fR \fIfile\fR] [\fB-p\fR \fIproject\fR]
25 [\fB-q\fR \fIqueuename\fR] \fItimespec\fR...
30 \fB/usr/bin/at\fR \fB-l\fR [\fB-p\fR \fIproject\fR] [\fB-q\fR \fIqueuename\fR] [\fIat_job_id\fR \fI...\fR]
35 \fB/usr/bin/at\fR \fB-r\fR \fIat_job_id\fR \fI...\fR
40 \fB/usr/bin/batch\fR [\fB-p\fR \fIproject\fR]
45 \fB/usr/xpg4/bin/at\fR [\fB-c\fR | \fB-k\fR | \fB-s\fR] [\fB-m\fR] [\fB-f\fR \fIfile\fR] [\fB-p\fR \fIproject\fR]
46 [\fB-q\fR \fIqueuename\fR] \fB-t\fR \fItime\fR
51 \fB/usr/xpg4/bin/at\fR [\fB-c\fR | \fB-k\fR | \fB-s\fR] [\fB-m\fR] [\fB-f\fR \fIfile\fR] [\fB-p\fR \fIproject\fR]
52 [\fB-q\fR \fIqueuename\fR] \fItimespec\fR...
57 \fB/usr/xpg4/bin/at\fR \fB-l\fR [\fB-p\fR \fIproject\fR] [\fB-q\fR \fIqueuename\fR]
58 [\fIat_job_id\fR \fI...\fR]
63 \fB/usr/xpg4/bin/at\fR \fB-r\fR \fIat_job_id\fR \fI...\fR
68 \fB/usr/xpg4/bin/batch\fR [\fB-p\fR \fIproject\fR]
75 The \fBat\fR utility reads commands from standard input and groups them
76 together as an \fIat-job\fR, to be executed at a later time.
79 The at-job is executed in a separate invocation of the shell, running in a
80 separate process group with no controlling terminal, except that the
81 environment variables, current working directory, file creation mask (see
82 \fBumask\fR(1)), and system resource limits (for \fBsh\fR and \fBksh\fR only,
83 see \fBulimit\fR(1)) in effect when the \fBat\fR utility is executed is
84 retained and used when the at-job is executed.
87 When the at-job is submitted, the \fIat_job_id\fR and scheduled time are
88 written to standard error. The \fIat_job_id\fR is an identifier that is a
89 string consisting solely of alphanumeric characters and the period character.
90 The \fIat_job_id\fR is assigned by the system when the job is scheduled such
91 that it uniquely identifies a particular job.
94 User notification and the processing of the job's standard output and standard
95 error are described under the \fB-m\fR option.
98 Users are permitted to use \fBat\fR and \fBbatch\fR (see below) if their name
99 appears in the file \fB/usr/lib/cron/at.allow\fR. If that file does not exist,
100 the file \fB/usr/lib/cron/at.deny\fR is checked to determine if the user should
101 be denied access to \fBat\fR. If neither file exists, only a user with the
102 \fBsolaris.jobs.user\fR authorization is allowed to submit a job. If only
103 \fBat.deny\fR exists and is empty, global usage is permitted. The
104 \fBat.allow\fR and \fBat.deny\fR files consist of one user name per line.
107 \fBcron\fR and \fBat\fR jobs are not be executed if the user's account is
108 locked. Only accounts which are not locked as defined in \fBshadow\fR(4) will
109 have their job or process executed.
113 The \fBbatch\fR utility reads commands to be executed at a later time.
116 Commands of the forms:
120 /usr/bin/batch [-p project]
121 /usr/xpg4/bin/batch [-p project]
128 are respectively equivalent to:
132 /usr/bin/at -q b [-p project] now
133 /usr/xpg4/bin/at -q b -m [-p project] now
140 where queue \fBb\fR is a special \fBat\fR queue, specifically for batch jobs.
141 Batch jobs are submitted to the batch queue for immediate execution. Execution
142 of submitted jobs can be delayed by limits on the number of jobs allowed to run
143 concurrently. See \fBqueuedefs\fR(4).
147 If the \fB-c\fR, \fB-k\fR, or \fB-s\fR options are not specified, the
148 \fBSHELL\fR environment variable by default determines which shell to use.
151 If \fBSHELL\fR is unset or \fBNULL\fR, \fB/usr/bin/sh\fR is used.
154 The following options are supported:
161 C shell. \fBcsh\fR(1) is used to execute the at-job.
170 Korn shell. \fBksh\fR(1) is used to execute the at-job.
179 Bourne shell. \fBsh\fR(1) is used to execute the at-job.
185 \fB\fB-f\fR \fIfile\fR \fR
188 Specifies the path of a file to be used as the source of the at-job, instead of
198 (The letter ell.) Reports all jobs scheduled for the invoking user if no
199 \fIat_job_id\fR operands are specified. If \fIat_job_id\fRs are specified,
200 reports only information for these jobs.
209 Sends mail to the invoking user after the at-job has run, announcing its
210 completion. Standard output and standard error produced by the at-job are
211 mailed to the user as well, unless redirected elsewhere. Mail is sent even if
212 the job produces no output.
214 If \fB-m\fR is not used, the job's standard output and standard error is
215 provided to the user by means of mail, unless they are redirected elsewhere; if
216 there is no such output to provide, the user is not notified of the job's
223 \fB\fB-p\fR \fIproject\fR\fR
226 Specifies under which project the \fBat\fR or \fBbatch\fR job is run. When used
227 with the \fB-l\fR option, limits the search to that particular project. Values
228 for \fIproject\fR is interpreted first as a project name, and then as a
229 possible project \fBID\fR, if entirely numeric. By default, the user's current
236 \fB\fB-q\fR \fIqueuename\fR \fR
239 Specifies in which queue to schedule a job for submission. When used with the
240 \fB-l\fR option, limits the search to that particular queue. Values for
241 \fIqueuename\fR are limited to the lower case letters \fBa\fR through \fBz\fR.
242 By default, at-jobs are scheduled in queue \fBa\fR. In contrast, queue \fBb\fR
243 is reserved for batch jobs. Since queue \fBc\fR is reserved for cron jobs, it
244 can not be used with the \fB-q\fR option.
250 \fB\fB-r\fR \fIat_job_id\fR \fR
253 Removes the jobs with the specified \fIat_job_id\fR operands that were
254 previously scheduled by the \fBat\fR utility.
260 \fB\fB-t\fR \fItime\fR \fR
263 Submits the job to be run at the time specified by the \fItime\fR
264 option-argument, which must have the format as specified by the \fBtouch\fR(1)
271 The following operands are supported:
275 \fB\fIat_job_id\fR \fR
278 The name reported by a previous invocation of the \fBat\fR utility at the time
279 the job was scheduled.
285 \fB\fItimespec\fR \fR
288 Submit the job to be run at the date and time specified. All of the
289 \fItimespec\fR operands are interpreted as if they were separated by space
290 characters and concatenated. The date and time are interpreted as being in the
291 timezone of the user (as determined by the \fBTZ\fR variable), unless a
292 timezone name appears as part of \fItime\fR below.
294 In the "C" locale, the following describes the three parts of the time
295 specification string. All of the values from the \fBLC_TIME\fR categories in
296 the "C" locale are recognized in a case-insensitive manner.
303 The \fItime\fR can be specified as one, two or four digits. One- and two-digit
304 numbers are taken to be hours, four-digit numbers to be hours and minutes. The
305 time can alternatively be specified as two numbers separated by a colon,
306 meaning \fIhour\fR\fB:\fR\fIminute\fR. An AM/PM indication (one of the values
307 from the \fBam_pm\fR keywords in the \fBLC_TIME\fR locale category) can follow
308 the time; otherwise, a 24-hour clock time is understood. A timezone name of
309 \fBGMT\fR, \fBUCT\fR, or \fBZULU \fR(case insensitive) can follow to specify
310 that the time is in Coordinated Universal Time. Other timezones can be
311 specified using the \fBTZ\fR environment variable. The \fItime\fR field can
312 also be one of the following tokens in the "C" locale:
316 \fB\fBmidnight\fR \fR
319 Indicates the time 12:00 am (00:00).
328 Indicates the time 12:00 pm.
337 Indicate the current day and time. Invoking \fBat\fR \fBnow\fR submits an
338 at-job for potentially immediate execution (that is, subject only to
339 unspecified scheduling delays).
350 An optional \fIdate\fR can be specified as either a month name (one of the
351 values from the \fBmon\fR or \fBabmon\fR keywords in the \fBLC_TIME\fR locale
352 category) followed by a day number (and possibly year number preceded by a
353 comma) or a day of the week (one of the values from the \fBday\fR or
354 \fBabday\fR keywords in the \fBLC_TIME\fR locale category). Two special days
355 are recognized in the "C" locale:
362 Indicates the current day.
368 \fB\fBtomorrow\fR \fR
371 Indicates the day following the current day.
374 If no \fIdate\fR is given, \fBtoday\fR is assumed if the given time is greater
375 than the current time, and \fBtomorrow\fR is assumed if it is less. If the
376 given month is less than the current month (and no year is given), next year is
383 \fB\fIincrement\fR \fR
386 The optional \fIincrement\fR is a number preceded by a plus sign (\fB+\fR) and
387 suffixed by one of the following: \fBminutes\fR, \fBhours\fR, \fBdays\fR,
388 \fBweeks\fR, \fBmonths\fR, or \fByears\fR. (The singular forms are also
389 accepted.) The keyword \fBnext\fR is equivalent to an increment number of \fB+
390 1\fR. For example, the following are equivalent commands:
407 The format of the \fBat\fR command line shown here is guaranteed only for the
408 "C" locale. Other locales are not supported for \fBmidnight\fR, \fBnoon\fR,
409 \fBnow\fR, \fBmon\fR, \fBabmon\fR, \fBday\fR, \fBabday\fR, \fBtoday\fR,
410 \fBtomorrow\fR, \fBminutes\fR, \fBhours\fR, \fBdays\fR, \fBweeks\fR,
411 \fBmonths\fR, \fByears\fR, and \fBnext\fR.
414 Since the commands run in a separate shell invocation, running in a separate
415 process group with no controlling terminal, open file descriptors, traps and
416 priority inherited from the invoking environment are lost.
420 \fBExample 1 \fRTypical Sequence at a Terminal
423 This sequence can be used at a terminal:
428 $ at \(mim 0730 tomorrow
436 \fBExample 2 \fRRedirecting Output
439 This sequence, which demonstrates redirecting standard error to a pipe, is
440 useful in a command procedure (the sequence of output redirection
441 specifications is significant):
446 $ at now + 1 hour <<!
447 diff file1 file2 2>&1 >outfile | mailx mygroup
453 \fBExample 3 \fRSelf-rescheduling a Job
456 To have a job reschedule itself, \fBat\fR can be invoked from within the
457 at-job. For example, this "daily-processing" script named \fBmy.daily\fR runs
458 every day (although \fBcrontab\fR is a more appropriate vehicle for such work):
463 # my.daily runs every day
464 at now tomorrow < my.daily
471 \fBExample 4 \fRVarious Time and Operand Presentations
474 The spacing of the three portions of the "C" locale \fItimespec\fR is quite
475 flexible as long as there are no ambiguities. Examples of various times and
476 operand presentations include:
494 \fBExample 5 \fRTypical Sequence at a Terminal
497 This sequence can be used at a terminal:
510 \fBExample 6 \fRRedirecting Output
513 This sequence, which demonstrates redirecting standard error to a pipe, is
514 useful in a command procedure (the sequence of output redirection
515 specifications is significant):
521 diff file1 file2 2>&1 >outfile | mailx mygroup
527 .SH ENVIRONMENT VARIABLES
530 See \fBenviron\fR(5) for descriptions of the following environment variables
531 that affect the execution of \fBat\fR and \fBbatch\fR: \fBLANG\fR,
532 \fBLC_ALL\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, \fBNLSPATH\fR, and
540 If the environment variable \fBDATEMSK\fR is set, \fBat\fR uses its value as
541 the full path name of a template file containing format strings. The strings
542 consist of format specifiers and text characters that are used to provide a
543 richer set of allowable date formats in different languages by appropriate
544 settings of the environment variable \fBLANG\fR or \fBLC_TIME\fR. The list of
545 allowable format specifiers is located in the \fBgetdate\fR(3C) manual page.
546 The formats described in the \fBOPERANDS\fR section for the \fItime\fR and
547 \fIdate\fR arguments, the special names \fBnoon\fR, \fBmidnight\fR, \fBnow\fR,
548 \fBnext\fR, \fBtoday\fR, \fBtomorrow\fR, and the \fIincrement\fR argument are
549 not recognized when \fBDATEMSK\fR is set.
558 Determine a name of a command interpreter to be used to invoke the at-job. If
559 the variable is unset or \fINULL\fR, \fBsh\fR is used. If it is set to a value
560 other than \fBsh\fR, the implementation uses that shell; a warning diagnostic
561 is printed telling which shell will be used.
570 Determine the timezone. The job is submitted for execution at the time
571 specified by \fItimespec\fR or \fB-t\fR \fItime\fR relative to the timezone
572 specified by the \fBTZ\fR variable. If \fItimespec\fR specifies a timezone, it
573 overrides \fBTZ\fR. If \fItimespec\fR does not specify a timezone and \fBTZ\fR
574 is unset or \fINULL\fR, an unspecified default timezone is used.
580 The following exit values are returned:
587 The \fBat\fR utility successfully submitted, removed or listed a job or jobs.
596 An error occurred, and the job will not be scheduled.
603 \fB\fB/usr/lib/cron/at.allow\fR \fR
606 names of users, one per line, who are authorized access to the \fBat\fR and
607 \fBbatch\fR utilities
613 \fB\fB/usr/lib/cron/at.deny\fR \fR
616 names of users, one per line, who are denied access to the \fBat\fR and
617 \fBbatch\fR utilities
623 See \fBattributes\fR(5) for descriptions of the following attributes:
632 ATTRIBUTE TYPE ATTRIBUTE VALUE
636 Interface Stability Standard
639 .SS "/usr/xpg4/bin/at"
647 ATTRIBUTE TYPE ATTRIBUTE VALUE
651 Interface Stability Standard
662 ATTRIBUTE TYPE ATTRIBUTE VALUE
666 Interface Stability Standard
669 .SS "/usr/xpg4/bin/batch"
677 ATTRIBUTE TYPE ATTRIBUTE VALUE
681 Interface Stability Standard
687 \fBauths\fR(1), \fBcrontab\fR(1), \fBcsh\fR(1), \fBdate\fR(1), \fBksh\fR(1),
688 \fBsh\fR(1), \fBtouch\fR(1), \fBulimit\fR(1), \fBumask\fR(1), \fBcron\fR(1M),
689 \fBgetdate\fR(3C), \fBauth_attr\fR(4), \fBshadow\fR(4), \fBqueuedefs\fR(4),
690 \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)
694 Regardless of queue used, \fBcron\fR(1M) has a limit of 100 jobs in execution
698 There can be delays in \fBcron\fR at job execution. In some cases, these delays
699 can compound to the point that \fBcron\fR job processing appears to be hung.
700 All jobs are executed eventually. When the delays are excessive, the only
701 workaround is to kill and restart \fBcron\fR.