at, batch --
execute commands at a later time
at [ -m ] [ -f file ]
[ -q letter ] time [ date ]
[ increment ]
at [ -m ] [ -f file ]
[ -q letter ] -t
at -r job-id ...
at -l [ job-id ... ]
at -l -q letter
The at and batch commands both accept one or
more commands from the standard input to be executed at a later
time. at and batch differ in the way the set of
commands, or job, is scheduled: at allows you to specify a
time when the job should be executed, while batch executes
the job when the system load level permits. After a job is queued
with either command, the program writes a job identifier
(made up of alphanumeric characters plus the period),
along with the time the job will execute, to standard error.
at takes the following arguments:
batch takes no arguments; it submits a job for immediate
execution at lower priority than an ordinary at job.
The time can be specified as 1, 2, or 4 digits. One- and
two- digit numbers are taken to be hours, four digits to be hours
and minutes. The time can alternately be specified as two numbers
separated by a colon, meaning hour:minute. A suffix
am or pm can be appended; otherwise a 24-hour
clock time is understood. The suffix utc can be used to
indicate Greenwich Mean Time (GMT). The special names
noon, midnight, and now are also
An optional date can be specified as either a month name
followed by a day number (and an optional year number preceded by a
comma) or a day of the week (spelt in full or abbreviated to three
characters). Two special ``days,'' today and
tomorrow, are recognized. If no date is given,
today is assumed if the given hour is greater than the
current hour and tomorrow 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.
The time and optional date arguments can be
modified with an increment argument of the form +n
units, where n is an integer and units is
one of the following: minutes, hours,
days, weeks, months, or
years. The singular form is also accepted, and
+1 unit can also be written next
unit. Thus, legitimate commands include:
at 0815am Jan 24, 1995
at 0815am Jan 24
at 8:15am Jan 24
at now + 1 day
at 5 pm Friday next week
-r job-id ...
Removes the specified job or jobs previously scheduled by the
at or batch command. job-id is a job
identifier returned by at or batch. Unless you
are root, you can only remove your own jobs.
-l [ job-id ... ]
Lists schedule times of specified jobs. If no job-ids are
specified, lists all jobs currently scheduled for the invoking user.
Unless you are root, you can only list your own jobs.
Places the specified job in a queue denoted by letter,
where letter is any lowercase letter from ``a'' to
``z''. The queue letter is appended to the job identifier. The
following letters have special significance:
For more information on the use of different queues, see the
Mail is sent to the invoking user
even if the at job produces no output.
If -m is not used, the at job's standard output
and standard error are mailed to the user, unless explicitly
Specifies the pathname of a file to use for the source of the
at job (instead of stdin).
Alternative format for specifying time in 2 digit
at and batch jobs are executed using
Standard output and standard error output are mailed to the user
unless they are redirected elsewhere. The shell environment
variables, current directory, umask, and ulimit
are retained when the commands are executed. Open file descriptors,
traps, and priorities are lost.
The shell environment for both at and batch can
be defined in the file /usr/lib/cron/.proto. If the file
/usr/lib/cron/.proto.a exists, at takes its
environment from this file instead. If the file
/usr/lib/cron/.proto.b exists, batch takes its
environment from this file instead.
Users are permitted to use at and batch if their
usernames (logins) appear in the file
/usr/lib/cron/at.allow. If that file does not exist, the
file /usr/lib/cron/at.deny is checked to determine if a
given user should be denied access to at and
batch. If neither file exists, only root is allowed to
submit a job. If only the at.deny file exists, and it is
empty, global usage is permitted. The allow/deny files consist of
one username per line.
If the system is installed with C2 security (this is the default,
unless the system administrator has relaxed the security), the user
will also need the chmodsuid kernel privilege. For more
information about system security and kernel privileges, see
``Using a secure system'' in the Operating System User's Guide
``Maintaining system security'' in the System Administration Guide.
at and batch return 0 on successful completion,
or 1 if an error occurs.
Complains about syntax errors and times out of range.
The simplest way to use at is to place a series of
commands in a file, one per line, and execute these commands at a
specified time with the following command:
at time < file
The following sequence can be used at a terminal to format the file
infile using the nroff text formatter, and place
the output in the file outfile.
nroff infile > outfile
The next example demonstrates redirecting standard error to a pipe
(|), which is useful in a shell procedure. The file
infile is formatted and the output placed in
outfile, with any errors generated being mailed to
user (output redirection is covered on the
nroff infile2 > &1 > outfile | mail user
To have a job reschedule itself, invoke at from within the
job. For example, if you want shellfile to run every
Thursday, executing a series of commands and then rescheduling
itself for the next Thursday, you can include code similar to the
following within shellfile:
echo "sh shellfile" | at 1900 thursday next week
A maximum limit of 500 outstanding at jobs is imposed.
The time taken to submit an at job increases exponentially
with the number of job files in the /usr/spool/cron/atjobs
The behavior of these commands depend on the ``cron''
main cron directory
list of allowed users
list of denied users
at and batch environment information
at shell environment
batch shell environment
at and batch are conformant with:
ISO/IEC DIS 99452:1992, Information technology Portable Operating System Interface (POSIX) Part 2: Shell and Utilities (IEEE Std 1003.21992);
AT&T SVID Issue 2;
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003