2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group. In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document. The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
25 .\" This notice shall appear on any product containing this material.
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
42 .\" Copyright 1989 AT&T
43 .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
44 .\" Portions Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved
46 .TH AT 1 "Oct 25, 2017"
48 at, batch \- execute commands at a later time
52 \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]
53 [\fB-q\fR \fIqueuename\fR] \fB-t\fR \fItime\fR
58 \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]
59 [\fB-q\fR \fIqueuename\fR] \fItimespec\fR...
64 \fB/usr/bin/at\fR \fB-l\fR [\fB-p\fR \fIproject\fR] [\fB-q\fR \fIqueuename\fR] [\fIat_job_id\fR \fI...\fR]
69 \fB/usr/bin/at\fR \fB-r\fR \fIat_job_id\fR \fI...\fR
74 \fB/usr/bin/batch\fR [\fB-p\fR \fIproject\fR]
81 The \fBat\fR utility reads commands from standard input and groups them
82 together as an \fIat-job\fR, to be executed at a later time.
85 The at-job is executed in a separate invocation of the shell, running in a
86 separate process group with no controlling terminal, except that the
87 environment variables, current working directory, file creation mask (see
88 \fBumask\fR(1)), and system resource limits (for \fBsh\fR and \fBksh\fR only,
89 see \fBulimit\fR(1)) in effect when the \fBat\fR utility is executed is
90 retained and used when the at-job is executed.
93 When the at-job is submitted, the \fIat_job_id\fR and scheduled time are
94 written to standard error. The \fIat_job_id\fR is an identifier that is a
95 string consisting solely of alphanumeric characters and the period character.
96 The \fIat_job_id\fR is assigned by the system when the job is scheduled such
97 that it uniquely identifies a particular job.
100 User notification and the processing of the job's standard output and standard
101 error are described under the \fB-m\fR option.
104 Users are permitted to use \fBat\fR and \fBbatch\fR (see below) if their name
105 appears in the file \fB/usr/lib/cron/at.allow\fR. If that file does not exist,
106 the file \fB/usr/lib/cron/at.deny\fR is checked to determine if the user should
107 be denied access to \fBat\fR. If neither file exists, only a user with the
108 \fBsolaris.jobs.user\fR authorization is allowed to submit a job. If only
109 \fBat.deny\fR exists and is empty, global usage is permitted. The
110 \fBat.allow\fR and \fBat.deny\fR files consist of one user name per line.
113 \fBcron\fR and \fBat\fR jobs are not be executed if the user's account is
114 locked. Only accounts which are not locked as defined in \fBshadow\fR(4) will
115 have their job or process executed.
119 The \fBbatch\fR utility reads commands to be executed at a later time.
122 Commands of the forms:
126 /usr/bin/batch [-p project]
133 are respectively equivalent to:
137 /usr/bin/at -q b -m [-p project] now
144 where queue \fBb\fR is a special \fBat\fR queue, specifically for batch jobs.
145 Batch jobs are submitted to the batch queue for immediate execution. Execution
146 of submitted jobs can be delayed by limits on the number of jobs allowed to run
147 concurrently. See \fBqueuedefs\fR(4).
151 If the \fB-c\fR, \fB-k\fR, or \fB-s\fR options are not specified, the
152 \fBSHELL\fR environment variable by default determines which shell to use.
155 If \fBSHELL\fR is unset or \fBNULL\fR, \fB/usr/bin/sh\fR is used.
158 The following options are supported:
165 C shell. \fBcsh\fR(1) is used to execute the at-job.
174 Korn shell. \fBksh\fR(1) is used to execute the at-job.
183 Bourne shell. \fBsh\fR(1) is used to execute the at-job.
189 \fB\fB-f\fR \fIfile\fR \fR
192 Specifies the path of a file to be used as the source of the at-job, instead of
202 (The letter ell.) Reports all jobs scheduled for the invoking user if no
203 \fIat_job_id\fR operands are specified. If \fIat_job_id\fRs are specified,
204 reports only information for these jobs.
213 Sends mail to the invoking user after the at-job has run, announcing its
214 completion. Standard output and standard error produced by the at-job are
215 mailed to the user as well, unless redirected elsewhere. Mail is sent even if
216 the job produces no output.
218 If \fB-m\fR is not used, the job's standard output and standard error is
219 provided to the user by means of mail, unless they are redirected elsewhere; if
220 there is no such output to provide, the user is not notified of the job's
227 \fB\fB-p\fR \fIproject\fR\fR
230 Specifies under which project the \fBat\fR or \fBbatch\fR job is run. When used
231 with the \fB-l\fR option, limits the search to that particular project. Values
232 for \fIproject\fR is interpreted first as a project name, and then as a
233 possible project \fBID\fR, if entirely numeric. By default, the user's current
240 \fB\fB-q\fR \fIqueuename\fR \fR
243 Specifies in which queue to schedule a job for submission. When used with the
244 \fB-l\fR option, limits the search to that particular queue. Values for
245 \fIqueuename\fR are limited to the lower case letters \fBa\fR through \fBz\fR.
246 By default, at-jobs are scheduled in queue \fBa\fR. In contrast, queue \fBb\fR
247 is reserved for batch jobs. Since queue \fBc\fR is reserved for cron jobs, it
248 can not be used with the \fB-q\fR option.
254 \fB\fB-r\fR \fIat_job_id\fR \fR
257 Removes the jobs with the specified \fIat_job_id\fR operands that were
258 previously scheduled by the \fBat\fR utility.
264 \fB\fB-t\fR \fItime\fR \fR
267 Submits the job to be run at the time specified by the \fItime\fR
268 option-argument, which must have the format as specified by the \fBtouch\fR(1)
275 The following operands are supported:
279 \fB\fIat_job_id\fR \fR
282 The name reported by a previous invocation of the \fBat\fR utility at the time
283 the job was scheduled.
289 \fB\fItimespec\fR \fR
292 Submit the job to be run at the date and time specified. All of the
293 \fItimespec\fR operands are interpreted as if they were separated by space
294 characters and concatenated. The date and time are interpreted as being in the
295 timezone of the user (as determined by the \fBTZ\fR variable), unless a
296 timezone name appears as part of \fItime\fR below.
298 In the "C" locale, the following describes the three parts of the time
299 specification string. All of the values from the \fBLC_TIME\fR categories in
300 the "C" locale are recognized in a case-insensitive manner.
307 The \fItime\fR can be specified as one, two or four digits. One- and two-digit
308 numbers are taken to be hours, four-digit numbers to be hours and minutes. The
309 time can alternatively be specified as two numbers separated by a colon,
310 meaning \fIhour\fR\fB:\fR\fIminute\fR. An AM/PM indication (one of the values
311 from the \fBam_pm\fR keywords in the \fBLC_TIME\fR locale category) can follow
312 the time; otherwise, a 24-hour clock time is understood. A timezone name of
313 \fBGMT\fR, \fBUCT\fR, or \fBZULU \fR(case insensitive) can follow to specify
314 that the time is in Coordinated Universal Time. Other timezones can be
315 specified using the \fBTZ\fR environment variable. The \fItime\fR field can
316 also be one of the following tokens in the "C" locale:
320 \fB\fBmidnight\fR \fR
323 Indicates the time 12:00 am (00:00).
332 Indicates the time 12:00 pm.
341 Indicate the current day and time. Invoking \fBat\fR \fBnow\fR submits an
342 at-job for potentially immediate execution (that is, subject only to
343 unspecified scheduling delays).
354 An optional \fIdate\fR can be specified as either a month name (one of the
355 values from the \fBmon\fR or \fBabmon\fR keywords in the \fBLC_TIME\fR locale
356 category) followed by a day number (and possibly year number preceded by a
357 comma) or a day of the week (one of the values from the \fBday\fR or
358 \fBabday\fR keywords in the \fBLC_TIME\fR locale category). Two special days
359 are recognized in the "C" locale:
366 Indicates the current day.
372 \fB\fBtomorrow\fR \fR
375 Indicates the day following the current day.
378 If no \fIdate\fR is given, \fBtoday\fR is assumed if the given time is greater
379 than the current time, and \fBtomorrow\fR is assumed if it is less. If the
380 given month is less than the current month (and no year is given), next year is
387 \fB\fIincrement\fR \fR
390 The optional \fIincrement\fR is a number preceded by a plus sign (\fB+\fR) and
391 suffixed by one of the following: \fBminutes\fR, \fBhours\fR, \fBdays\fR,
392 \fBweeks\fR, \fBmonths\fR, or \fByears\fR. (The singular forms are also
393 accepted.) The keyword \fBnext\fR is equivalent to an increment number of \fB+
394 1\fR. For example, the following are equivalent commands:
411 The format of the \fBat\fR command line shown here is guaranteed only for the
412 "C" locale. Other locales are not supported for \fBmidnight\fR, \fBnoon\fR,
413 \fBnow\fR, \fBmon\fR, \fBabmon\fR, \fBday\fR, \fBabday\fR, \fBtoday\fR,
414 \fBtomorrow\fR, \fBminutes\fR, \fBhours\fR, \fBdays\fR, \fBweeks\fR,
415 \fBmonths\fR, \fByears\fR, and \fBnext\fR.
418 Since the commands run in a separate shell invocation, running in a separate
419 process group with no controlling terminal, open file descriptors, traps and
420 priority inherited from the invoking environment are lost.
424 \fBExample 1 \fRTypical Sequence at a Terminal
427 This sequence can be used at a terminal:
432 $ at \(mim 0730 tomorrow
440 \fBExample 2 \fRRedirecting Output
443 This sequence, which demonstrates redirecting standard error to a pipe, is
444 useful in a command procedure (the sequence of output redirection
445 specifications is significant):
450 $ at now + 1 hour <<!
451 diff file1 file2 2>&1 >outfile | mailx mygroup
457 \fBExample 3 \fRSelf-rescheduling a Job
460 To have a job reschedule itself, \fBat\fR can be invoked from within the
461 at-job. For example, this "daily-processing" script named \fBmy.daily\fR runs
462 every day (although \fBcrontab\fR is a more appropriate vehicle for such work):
467 # my.daily runs every day
468 at now tomorrow < my.daily
475 \fBExample 4 \fRVarious Time and Operand Presentations
478 The spacing of the three portions of the "C" locale \fItimespec\fR is quite
479 flexible as long as there are no ambiguities. Examples of various times and
480 operand presentations include:
498 \fBExample 5 \fRTypical Sequence at a Terminal
501 This sequence can be used at a terminal:
514 \fBExample 6 \fRRedirecting Output
517 This sequence, which demonstrates redirecting standard error to a pipe, is
518 useful in a command procedure (the sequence of output redirection
519 specifications is significant):
525 diff file1 file2 2>&1 >outfile | mailx mygroup
531 .SH ENVIRONMENT VARIABLES
534 See \fBenviron\fR(5) for descriptions of the following environment variables
535 that affect the execution of \fBat\fR and \fBbatch\fR: \fBLANG\fR,
536 \fBLC_ALL\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, \fBNLSPATH\fR, and
544 If the environment variable \fBDATEMSK\fR is set, \fBat\fR uses its value as
545 the full path name of a template file containing format strings. The strings
546 consist of format specifiers and text characters that are used to provide a
547 richer set of allowable date formats in different languages by appropriate
548 settings of the environment variable \fBLANG\fR or \fBLC_TIME\fR. The list of
549 allowable format specifiers is located in the \fBgetdate\fR(3C) manual page.
550 The formats described in the \fBOPERANDS\fR section for the \fItime\fR and
551 \fIdate\fR arguments, the special names \fBnoon\fR, \fBmidnight\fR, \fBnow\fR,
552 \fBnext\fR, \fBtoday\fR, \fBtomorrow\fR, and the \fIincrement\fR argument are
553 not recognized when \fBDATEMSK\fR is set.
562 Determine a name of a command interpreter to be used to invoke the at-job. If
563 the variable is unset or \fINULL\fR, \fBsh\fR is used. If it is set to a value
564 other than \fBsh\fR, the implementation uses that shell; a warning diagnostic
565 is printed telling which shell will be used.
574 Determine the timezone. The job is submitted for execution at the time
575 specified by \fItimespec\fR or \fB-t\fR \fItime\fR relative to the timezone
576 specified by the \fBTZ\fR variable. If \fItimespec\fR specifies a timezone, it
577 overrides \fBTZ\fR. If \fItimespec\fR does not specify a timezone and \fBTZ\fR
578 is unset or \fINULL\fR, an unspecified default timezone is used.
584 The following exit values are returned:
591 The \fBat\fR utility successfully submitted, removed or listed a job or jobs.
600 An error occurred, and the job will not be scheduled.
607 \fB\fB/usr/lib/cron/at.allow\fR \fR
610 names of users, one per line, who are authorized access to the \fBat\fR and
611 \fBbatch\fR utilities
617 \fB\fB/usr/lib/cron/at.deny\fR \fR
620 names of users, one per line, who are denied access to the \fBat\fR and
621 \fBbatch\fR utilities
627 See \fBattributes\fR(5) for descriptions of the following attributes:
636 ATTRIBUTE TYPE ATTRIBUTE VALUE
640 Interface Stability Standard
651 ATTRIBUTE TYPE ATTRIBUTE VALUE
655 Interface Stability Standard
661 \fBauths\fR(1), \fBcrontab\fR(1), \fBcsh\fR(1), \fBdate\fR(1), \fBksh\fR(1),
662 \fBsh\fR(1), \fBtouch\fR(1), \fBulimit\fR(1), \fBumask\fR(1), \fBcron\fR(8),
663 \fBgetdate\fR(3C), \fBauth_attr\fR(4), \fBshadow\fR(4), \fBqueuedefs\fR(4),
664 \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)
668 Regardless of queue used, \fBcron\fR(8) has a limit of 100 jobs in execution
672 There can be delays in \fBcron\fR at job execution. In some cases, these delays
673 can compound to the point that \fBcron\fR job processing appears to be hung.
674 All jobs are executed eventually. When the delays are excessive, the only
675 workaround is to kill and restart \fBcron\fR.