'\" te .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved. .\" Copyright 1989 AT&T .\" Portions Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved .\" 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 .\" http://www.opengroup.org/bookstore/. .\" 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. .\" This notice shall appear on any product containing this material. .\" 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. .\" 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. .\" 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] .TH AT 1 "Apr 13, 2005" .SH NAME at, batch \- execute commands at a later time .SH SYNOPSIS .LP .nf \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] [\fB-q\fR \fIqueuename\fR] \fB-t\fR \fItime\fR .fi .LP .nf \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] [\fB-q\fR \fIqueuename\fR] \fItimespec\fR... .fi .LP .nf \fB/usr/bin/at\fR \fB-l\fR [\fB-p\fR \fIproject\fR] [\fB-q\fR \fIqueuename\fR] [\fIat_job_id.\fR \fI\&..\fR] .fi .LP .nf \fB/usr/bin/at\fR \fB-r\fR \fIat_job_id.\fR \fI\&..\fR .fi .LP .nf \fB/usr/bin/batch\fR [\fB-p\fR \fIproject\fR] .fi .LP .nf \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] [\fB-q\fR \fIqueuename\fR] \fB-t\fR \fItime\fR .fi .LP .nf \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] [\fB-q\fR \fIqueuename\fR] \fItimespec\fR... .fi .LP .nf \fB/usr/xpg4/bin/at\fR \fB-l\fR [\fB-p\fR \fIproject\fR] [\fB-q\fR \fIqueuename\fR] [\fIat_job_id.\fR \fI\&..\fR] .fi .LP .nf \fB/usr/xpg4/bin/at\fR \fB-r\fR \fIat_job_id.\fR \fI\&..\fR .fi .LP .nf \fB/usr/xpg4/bin/batch\fR [\fB-p\fR \fIproject\fR] .fi .SH DESCRIPTION .SS "at" .sp .LP The \fBat\fR utility reads commands from standard input and groups them together as an \fIat-job\fR, to be executed at a later time. .sp .LP The at-job is executed in a separate invocation of the shell, running in a separate process group with no controlling terminal, except that the environment variables, current working directory, file creation mask (see \fBumask\fR(1)), and system resource limits (for \fBsh\fR and \fBksh\fR only, see \fBulimit\fR(1)) in effect when the \fBat\fR utility is executed is retained and used when the at-job is executed. .sp .LP When the at-job is submitted, the \fIat_job_id\fR and scheduled time are written to standard error. The \fIat_job_id\fR is an identifier that is a string consisting solely of alphanumeric characters and the period character. The \fIat_job_id\fR is assigned by the system when the job is scheduled such that it uniquely identifies a particular job. .sp .LP User notification and the processing of the job's standard output and standard error are described under the \fB-m\fR option. .sp .LP Users are permitted to use \fBat\fR and \fBbatch\fR (see below) if their name appears in the file \fB/usr/lib/cron/at.allow\fR. If that file does not exist, the file \fB/usr/lib/cron/at.deny\fR is checked to determine if the user should be denied access to \fBat\fR. If neither file exists, only a user with the \fBsolaris.jobs.user\fR authorization is allowed to submit a job. If only \fBat.deny\fR exists and is empty, global usage is permitted. The \fBat.allow\fR and \fBat.deny\fR files consist of one user name per line. .sp .LP \fBcron\fR and \fBat\fR jobs are not be executed if the user's account is locked. Only accounts which are not locked as defined in \fBshadow\fR(4) will have their job or process executed. .SS "batch" .sp .LP The \fBbatch\fR utility reads commands to be executed at a later time. .sp .LP Commands of the forms: .sp .in +2 .nf /usr/bin/batch [-p project] /usr/xpg4/bin/batch [-p project] .fi .in -2 .sp .sp .LP are respectively equivalent to: .sp .in +2 .nf /usr/bin/at -q b [-p project] now /usr/xpg4/bin/at -q b -m [-p project] now .fi .in -2 .sp .sp .LP where queue \fBb\fR is a special \fBat\fR queue, specifically for batch jobs. Batch jobs are submitted to the batch queue for immediate execution. Execution of submitted jobs can be delayed by limits on the number of jobs allowed to run concurrently. See \fBqueuedefs\fR(4). .SH OPTIONS .sp .LP If the \fB-c\fR, \fB-k\fR, or \fB-s\fR options are not specified, the \fBSHELL\fR environment variable by default determines which shell to use. .sp .LP If \fBSHELL\fR is unset or \fBNULL\fR, \fB/usr/bin/sh\fR is used. .sp .LP The following options are supported: .sp .ne 2 .na \fB\fB-c\fR \fR .ad .RS 17n C shell. \fBcsh\fR(1) is used to execute the at-job. .RE .sp .ne 2 .na \fB\fB-k\fR \fR .ad .RS 17n Korn shell. \fBksh\fR(1) is used to execute the at-job. .RE .sp .ne 2 .na \fB\fB-s\fR \fR .ad .RS 17n Bourne shell. \fBsh\fR(1) is used to execute the at-job. .RE .sp .ne 2 .na \fB\fB-f\fR \fIfile\fR \fR .ad .RS 17n Specifies the path of a file to be used as the source of the at-job, instead of standard input. .RE .sp .ne 2 .na \fB\fB-l\fR \fR .ad .RS 17n (The letter ell.) Reports all jobs scheduled for the invoking user if no \fIat_job_id\fR operands are specified. If \fIat_job_id\fRs are specified, reports only information for these jobs. .RE .sp .ne 2 .na \fB\fB-m\fR \fR .ad .RS 17n Sends mail to the invoking user after the at-job has run, announcing its completion. Standard output and standard error produced by the at-job are mailed to the user as well, unless redirected elsewhere. Mail is sent even if the job produces no output. .sp If \fB-m\fR is not used, the job's standard output and standard error is provided to the user by means of mail, unless they are redirected elsewhere; if there is no such output to provide, the user is not notified of the job's completion. .RE .sp .ne 2 .na \fB\fB-p\fR \fIproject\fR\fR .ad .RS 17n Specifies under which project the \fBat\fR or \fBbatch\fR job is run. When used with the \fB-l\fR option, limits the search to that particular project. Values for \fIproject\fR is interpreted first as a project name, and then as a possible project \fBID\fR, if entirely numeric. By default, the user's current project is used. .RE .sp .ne 2 .na \fB\fB-q\fR \fIqueuename\fR \fR .ad .RS 17n Specifies in which queue to schedule a job for submission. When used with the \fB-l\fR option, limits the search to that particular queue. Values for \fIqueuename\fR are limited to the lower case letters \fBa\fR through \fBz\fR. By default, at-jobs are scheduled in queue \fBa\fR. In contrast, queue \fBb\fR is reserved for batch jobs. Since queue \fBc\fR is reserved for cron jobs, it can not be used with the \fB-q\fR option. .RE .sp .ne 2 .na \fB\fB-r\fR \fIat_job_id\fR \fR .ad .RS 17n Removes the jobs with the specified \fIat_job_id\fR operands that were previously scheduled by the \fBat\fR utility. .RE .sp .ne 2 .na \fB\fB-t\fR \fItime\fR \fR .ad .RS 17n Submits the job to be run at the time specified by the \fItime\fR option-argument, which must have the format as specified by the \fBtouch\fR(1) utility. .RE .SH OPERANDS .sp .LP The following operands are supported: .sp .ne 2 .na \fB\fIat_job_id\fR \fR .ad .RS 14n The name reported by a previous invocation of the \fBat\fR utility at the time the job was scheduled. .RE .sp .ne 2 .na \fB\fItimespec\fR \fR .ad .RS 14n Submit the job to be run at the date and time specified. All of the \fItimespec\fR operands are interpreted as if they were separated by space characters and concatenated. The date and time are interpreted as being in the timezone of the user (as determined by the \fBTZ\fR variable), unless a timezone name appears as part of \fItime\fR below. .sp In the "C" locale, the following describes the three parts of the time specification string. All of the values from the \fBLC_TIME\fR categories in the "C" locale are recognized in a case-insensitive manner. .sp .ne 2 .na \fB\fItime\fR \fR .ad .RS 14n The \fItime\fR can be specified as one, two or four digits. One- and two-digit numbers are taken to be hours, four-digit numbers to be hours and minutes. The time can alternatively be specified as two numbers separated by a colon, meaning \fIhour\fR\fB:\fR\fIminute\fR. An AM/PM indication (one of the values from the \fBam_pm\fR keywords in the \fBLC_TIME\fR locale category) can follow the time; otherwise, a 24-hour clock time is understood. A timezone name of \fBGMT\fR, \fBUCT\fR, or \fBZULU \fR(case insensitive) can follow to specify that the time is in Coordinated Universal Time. Other timezones can be specified using the \fBTZ\fR environment variable. The \fItime\fR field can also be one of the following tokens in the "C" locale: .sp .ne 2 .na \fB\fBmidnight\fR \fR .ad .RS 13n Indicates the time 12:00 am (00:00). .RE .sp .ne 2 .na \fB\fBnoon\fR \fR .ad .RS 13n Indicates the time 12:00 pm. .RE .sp .ne 2 .na \fB\fBnow\fR \fR .ad .RS 13n Indicate the current day and time. Invoking \fBat\fR \fBnow\fR submits an at-job for potentially immediate execution (that is, subject only to unspecified scheduling delays). .RE .RE .sp .ne 2 .na \fB\fIdate\fR \fR .ad .RS 14n An optional \fIdate\fR can be specified as either a month name (one of the values from the \fBmon\fR or \fBabmon\fR keywords in the \fBLC_TIME\fR locale category) followed by a day number (and possibly year number preceded by a comma) or a day of the week (one of the values from the \fBday\fR or \fBabday\fR keywords in the \fBLC_TIME\fR locale category). Two special days are recognized in the "C" locale: .sp .ne 2 .na \fB\fBtoday\fR \fR .ad .RS 13n Indicates the current day. .RE .sp .ne 2 .na \fB\fBtomorrow\fR \fR .ad .RS 13n Indicates the day following the current day. .RE If no \fIdate\fR is given, \fBtoday\fR is assumed if the given time is greater than the current time, and \fBtomorrow\fR is assumed if it is less. If the given month is less than the current month (and no year is given), next year is assumed. .RE .sp .ne 2 .na \fB\fIincrement\fR \fR .ad .RS 14n The optional \fIincrement\fR is a number preceded by a plus sign (\fB+\fR) and suffixed by one of the following: \fBminutes\fR, \fBhours\fR, \fBdays\fR, \fBweeks\fR, \fBmonths\fR, or \fByears\fR. (The singular forms are also accepted.) The keyword \fBnext\fR is equivalent to an increment number of \fB+ 1\fR. For example, the following are equivalent commands: .sp .in +2 .nf \fBat 2pm + 1 week at 2pm next week\fR .fi .in -2 .sp .RE .RE .SH USAGE .sp .LP The format of the \fBat\fR command line shown here is guaranteed only for the "C" locale. Other locales are not supported for \fBmidnight\fR, \fBnoon\fR, \fBnow\fR, \fBmon\fR, \fBabmon\fR, \fBday\fR, \fBabday\fR, \fBtoday\fR, \fBtomorrow\fR, \fBminutes\fR, \fBhours\fR, \fBdays\fR, \fBweeks\fR, \fBmonths\fR, \fByears\fR, and \fBnext\fR. .sp .LP Since the commands run in a separate shell invocation, running in a separate process group with no controlling terminal, open file descriptors, traps and priority inherited from the invoking environment are lost. .SH EXAMPLES .SS "at" .LP \fBExample 1 \fRTypical Sequence at a Terminal .sp .LP This sequence can be used at a terminal: .sp .in +2 .nf $ at \(mim 0730 tomorrow sort < file >outfile .fi .in -2 .sp .LP \fBExample 2 \fRRedirecting Output .sp .LP This sequence, which demonstrates redirecting standard error to a pipe, is useful in a command procedure (the sequence of output redirection specifications is significant): .sp .in +2 .nf $ at now + 1 hour <&1 >outfile | mailx mygroup .fi .in -2 .sp .LP \fBExample 3 \fRSelf-rescheduling a Job .sp .LP To have a job reschedule itself, \fBat\fR can be invoked from within the at-job. For example, this "daily-processing" script named \fBmy.daily\fR runs every day (although \fBcrontab\fR is a more appropriate vehicle for such work): .sp .in +2 .nf # my.daily runs every day at now tomorrow < my.daily daily-processing .fi .in -2 .sp .LP \fBExample 4 \fRVarious Time and Operand Presentations .sp .LP The spacing of the three portions of the "C" locale \fItimespec\fR is quite flexible as long as there are no ambiguities. Examples of various times and operand presentations include: .sp .in +2 .nf at 0815am Jan 24 at 8 :15amjan24 at now "+ 1day" at 5 pm FRIday at '17 utc+ 30minutes' .fi .in -2 .sp .SS "batch" .LP \fBExample 5 \fRTypical Sequence at a Terminal .sp .LP This sequence can be used at a terminal: .sp .in +2 .nf $ batch sort outfile .fi .in -2 .sp .LP \fBExample 6 \fRRedirecting Output .sp .LP This sequence, which demonstrates redirecting standard error to a pipe, is useful in a command procedure (the sequence of output redirection specifications is significant): .sp .in +2 .nf $ batch <&1 >outfile | mailx mygroup ! .fi .in -2 .sp .SH ENVIRONMENT VARIABLES .sp .LP See \fBenviron\fR(5) for descriptions of the following environment variables that affect the execution of \fBat\fR and \fBbatch\fR: \fBLANG\fR, \fBLC_ALL\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, \fBNLSPATH\fR, and \fBLC_TIME\fR. .sp .ne 2 .na \fB\fBDATEMSK\fR \fR .ad .RS 12n If the environment variable \fBDATEMSK\fR is set, \fBat\fR uses its value as the full path name of a template file containing format strings. The strings consist of format specifiers and text characters that are used to provide a richer set of allowable date formats in different languages by appropriate settings of the environment variable \fBLANG\fR or \fBLC_TIME\fR. The list of allowable format specifiers is located in the \fBgetdate\fR(3C) manual page. The formats described in the \fBOPERANDS\fR section for the \fItime\fR and \fIdate\fR arguments, the special names \fBnoon\fR, \fBmidnight\fR, \fBnow\fR, \fBnext\fR, \fBtoday\fR, \fBtomorrow\fR, and the \fIincrement\fR argument are not recognized when \fBDATEMSK\fR is set. .RE .sp .ne 2 .na \fB\fBSHELL\fR \fR .ad .RS 12n Determine a name of a command interpreter to be used to invoke the at-job. If the variable is unset or \fINULL\fR, \fBsh\fR is used. If it is set to a value other than \fBsh\fR, the implementation uses that shell; a warning diagnostic is printed telling which shell will be used. .RE .sp .ne 2 .na \fB\fBTZ\fR \fR .ad .RS 12n Determine the timezone. The job is submitted for execution at the time specified by \fItimespec\fR or \fB-t\fR \fItime\fR relative to the timezone specified by the \fBTZ\fR variable. If \fItimespec\fR specifies a timezone, it overrides \fBTZ\fR. If \fItimespec\fR does not specify a timezone and \fBTZ\fR is unset or \fINULL\fR, an unspecified default timezone is used. .RE .SH EXIT STATUS .sp .LP The following exit values are returned: .sp .ne 2 .na \fB\fB0\fR \fR .ad .RS 7n The \fBat\fR utility successfully submitted, removed or listed a job or jobs. .RE .sp .ne 2 .na \fB\fB>0\fR \fR .ad .RS 7n An error occurred, and the job will not be scheduled. .RE .SH FILES .sp .ne 2 .na \fB\fB/usr/lib/cron/at.allow\fR \fR .ad .RS 27n names of users, one per line, who are authorized access to the \fBat\fR and \fBbatch\fR utilities .RE .sp .ne 2 .na \fB\fB/usr/lib/cron/at.deny\fR \fR .ad .RS 27n names of users, one per line, who are denied access to the \fBat\fR and \fBbatch\fR utilities .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .SS "/usr/bin/at" .sp .sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ CSI Not enabled _ Interface Stability Standard .TE .SS "/usr/xpg4/bin/at" .sp .sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ CSI Not enabled _ Interface Stability Standard .TE .SS "/usr/bin/batch" .sp .sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ CSI Enabled _ Interface Stability Standard .TE .SS "/usr/xpg4/bin/batch" .sp .sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ CSI Enabled _ Interface Stability Standard .TE .SH SEE ALSO .sp .LP \fBauths\fR(1), \fBcrontab\fR(1), \fBcsh\fR(1), \fBdate\fR(1), \fBksh\fR(1), \fBsh\fR(1), \fBtouch\fR(1), \fBulimit\fR(1), \fBumask\fR(1), \fBcron\fR(1M), \fBgetdate\fR(3C), \fBauth_attr\fR(4), \fBshadow\fR(4), \fBqueuedefs\fR(4), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5) .SH NOTES .sp .LP Regardless of queue used, \fBcron\fR(1M) has a limit of 100 jobs in execution at any time. .sp .LP There can be delays in \fBcron\fR at job execution. In some cases, these delays can compound to the point that \fBcron\fR job processing appears to be hung. All jobs are executed eventually. When the delays are excessive, the only workaround is to kill and restart \fBcron\fR.