User Commands at(1)
NAME
at, batch - execute commands at a later time
SYNOPSIS
/usr/bin/at [-c -k -s] [-m] [-f file] [-p project]
[-q queuename] -t time
/usr/bin/at [-c -k -s] [-m] [-f file] [-p project]
[-q queuename] timespec...
/usr/bin/at -l [-p project] [-q queuename] [atjobid. ..]
/usr/bin/at -r atjobid. ..
/usr/bin/batch [-p project]
/usr/xpg4/bin/at [-c -k -s] [-m] [-f file] [-p project]
[-q queuename] -t time
/usr/xpg4/bin/at [-c -k -s] [-m] [-f file] [-p project]
[-q queuename] timespec...
/usr/xpg4/bin/at -l [-p project] [-q queuename]
[atjobid. ..]
/usr/xpg4/bin/at -r atjobid. ..
/usr/xpg4/bin/batch [-p project]
DESCRIPTION
at
The at utility reads commands from standard input and groups
them together as an at-job, to be executed at a later time.
The at-job is executed in a separate invocation of the
shell, running in a separate process group with no control-
ling terminal, except that the environment variables,
current working directory, file creation mask (see
umask(1)), and system resource limits (for sh and ksh only,
see ulimit(1)) in effect when the at utility is executed is
retained and used when the at-job is executed.
SunOS 5.11 Last change: 13 Apr 2005 1
User Commands at(1)
When the at-job is submitted, the atjobid and scheduled
time are written to standard error. The atjobid is an
identifier that is a string consisting solely of
alphanumeric characters and the period character. The
atjobid is assigned by the system when the job is
scheduled such that it uniquely identifies a particular job.
User notification and the processing of the job's standard
output and standard error are described under the -m option.
Users are permitted to use at and batch (see below) if their
name appears 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 the user should be denied access to
at. If neither file exists, only a user with the
solaris.jobs.user authorization is allowed to submit a job.
If only at.deny exists and is empty, global usage is permit-
ted. The at.allow and at.deny files consist of one user name
per line.
cron and at jobs are not be executed if the user's account
is locked. Only accounts which are not locked as defined in
shadow(4) will have their job or process executed.
batch
The batch utility reads commands to be executed at a later
time.
Commands of the forms:
/usr/bin/batch [-p project]
/usr/xpg4/bin/batch [-p project]
are respectively equivalent to:
/usr/bin/at -q b [-p project] now
/usr/xpg4/bin/at -q b -m [-p project] now
where queue b is a special at 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
SunOS 5.11 Last change: 13 Apr 2005 2
User Commands at(1)
concurrently. See queuedefs(4).
OPTIONS
If the -c, -k, or -s options are not specified, the SHEL
environment variable by default determines which shell to
use.
For /usr/xpg4/bin/at and /usr/xpg4/bin/batch, if SHEL is
unset or NUL, /usr/xpg4/bin/sh is used.
For usr/bin/at and /usr/bin/batch, if SHEL is unset or
NUL, /bin/sh is used.
The following options are supported:
-c C shell. csh(1) is used to execute the at-
job.
-k Korn shell. ksh(1) is used to execute the
at-job.
-s Bourne shell. sh(1) is used to execute the
at-job.
-f file Specifies the path of a file to be used as
the source of the at-job, instead of stan-
dard input.
-l (The letter ell.) Reports all jobs
scheduled for the invoking user if no
atjobid operands are specified. If
atjobids are specified, reports only
information for these jobs.
-m 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.
If -m is not used, the job's standard out-
put and standard error is provided to the
user by means of mail, unless they are
SunOS 5.11 Last change: 13 Apr 2005 3
User Commands at(1)
redirected elsewhere; if there is no such
output to provide, the user is not notified
of the job's completion.
-p project Specifies under which project the at or
batch job is run. When used with the -l
option, limits the search to that particu-
lar project. Values for project is inter-
preted first as a project name, and then as
a possible project ID, if entirely numeric.
By default, the user's current project is
used.
-q queuename Specifies in which queue to schedule a job
for submission. When used with the -l
option, limits the search to that particu-
lar queue. Values for queuename are limited
to the lower case letters a through z. By
default, at-jobs are scheduled in queue a.
In contrast, queue b is reserved for batch
jobs. Since queue c is reserved for cron
jobs, it can not be used with the -q
option.
-r atjobid Removes the jobs with the specified
atjobid operands that were previously
scheduled by the at utility.
-t time Submits the job to be run at the time
specified by the time option-argument,
which must have the format as specified by
the touch(1) utility.
OPERANDS
The following operands are supported:
atjobid The name reported by a previous invocation of
the at utility at the time the job was
scheduled.
timespec Submit the job to be run at the date and time
specified. All of the timespec 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 TZ variable),
SunOS 5.11 Last change: 13 Apr 2005 4
User Commands at(1)
unless a timezone name appears as part of time
below.
In the "C" locale, the following describes the
three parts of the time specification string.
All of the values from the LCTIME categories
in the "C" locale are recognized in a case-
insensitive manner.
time The time 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 speci-
fied as two numbers separated by
a colon, meaning hour:minute. An
AM/PM indication (one of the
values from the ampm keywords
in the LCTIME locale category)
can follow the time; otherwise,
a 24-hour clock time is under-
stood. A timezone name of GMT,
UCT, or ZULU (case insensitive)
can follow to specify that the
time is in Coordinated Universal
Time. Other timezones can be
specified using the TZ environ-
ment variable. The time field
can also be one of the following
tokens in the "C" locale:
midnight Indicates the time
12:00 am (00:00).
noon Indicates the time
12:00 pm.
now Indicate the
current day and
time. Invoking at
now submits an at-
job for potentially
immediate execution
(that is, subject
only to unspecified
scheduling delays).
SunOS 5.11 Last change: 13 Apr 2005 5
User Commands at(1)
date An optional date can be speci-
fied as either a month name (one
of the values from the mon or
abmon keywords in the LCTIME
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 day or abday
keywords in the LCTIME locale
category). Two special days are
recognized in the "C" locale:
today Indicates the
current day.
tomorrow Indicates the day
following the
current day.
If no date is given, today is
assumed if the given time is
greater than the current time,
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.
increment The optional increment is a
number preceded by a plus sign
(]) and suffixed by one of the
following: minutes, hours, days,
weeks, months, or years. (The
singular forms are also
accepted.) The keyword next is
equivalent to an increment
number of ] 1. For example, the
following are equivalent com-
mands:
at 2pm ] 1 week
at 2pm next week
USAGE
SunOS 5.11 Last change: 13 Apr 2005 6
User Commands at(1)
The format of the at command line shown here is guaranteed
only for the "C" locale. Other locales are not supported for
midnight, noon, now, mon, abmon, day, abday, today, tomor-
row, minutes, hours, days, weeks, months, years, and next.
Since the commands run in a separate shell invocation, run-
ning in a separate process group with no controlling termi-
nal, open file descriptors, traps and priority inherited
from the invoking environment are lost.
EXAMPLES
at
Example 1 Typical Sequence at a Terminal
This sequence can be used at a terminal:
$ at -m 0730 tomorrow
sort < file >outfile
Example 2 Redirecting Output
This sequence, which demonstrates redirecting standard error
to a pipe, is useful in a command procedure (the sequence of
output redirection specifications is significant):
$ at now ] 1 hour <&1 >outfile mailx mygroup
Example 3 Self-rescheduling a Job
To have a job reschedule itself, at can be invoked from
within the at-job. For example, this "daily-processing"
script named my.daily runs every day (although crontab is a
more appropriate vehicle for such work):
# my.daily runs every day
at now tomorrow < my.daily
daily-processing
SunOS 5.11 Last change: 13 Apr 2005 7
User Commands at(1)
Example 4 Various Time and Operand Presentations
The spacing of the three portions of the "C" locale timespec
is quite flexible as long as there are no ambiguities. Exam-
ples of various times and operand presentations include:
at 0815am Jan 24
at 8 :15amjan24
at now "] 1day"
at 5 pm FRIday
at '17
utc]
30minutes'
batch
Example 5 Typical Sequence at a Terminal
This sequence can be used at a terminal:
$ batch
sort outfile
Example 6 Redirecting Output
This sequence, which demonstrates redirecting standard error
to a pipe, is useful in a command procedure (the sequence of
output redirection specifications is significant):
$ batch <&1 >outfile mailx mygroup
!
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment
variables that affect the execution of at and batch: LANG,
LCAL, LCTYPE, LCMESAGES, NLSPATH, and LCTIME.
DATEMSK If the environment variable DATEMSK is set, at
uses its value as the full path name of a
SunOS 5.11 Last change: 13 Apr 2005 8
User Commands at(1)
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 vari-
able LANG or LCTIME. The list of allowable for-
mat specifiers is located in the getdate(3C)
manual page. The formats described in the
OPERANDS section for the time and date argu-
ments, the special names noon, midnight, now,
next, today, tomorrow, and the increment argu-
ment are not recognized when DATEMSK is set.
SHEL Determine a name of a command interpreter to be
used to invoke the at-job. If the variable is
unset or NUL, sh is used. If it is set to a
value other than sh, the implementation uses
that shell; a warning diagnostic is printed tel-
ling which shell will be used.
TZ Determine the timezone. The job is submitted for
execution at the time specified by timespec or
-t time relative to the timezone specified by
the TZ variable. If timespec specifies a
timezone, it overrides TZ. If timespec does not
specify a timezone and TZ is unset or NUL, an
unspecified default timezone is used.
EXIT STATUS
The following exit values are returned:
0 The at utility successfully submitted, removed or
listed a job or jobs.
>0 An error occurred, and the job will not be scheduled.
FILES
/usr/lib/cron/at.allow names of users, one per line, who
are authorized access to the at
and batch utilities
/usr/lib/cron/at.deny names of users, one per line, who
are denied access to the at and
batch utilities
SunOS 5.11 Last change: 13 Apr 2005 9
User Commands at(1)
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
/usr/bin/at
ATRIBUTE TYPE ATRIBUTE VALUE
Availability SUNWcsu
CSI Not enabled
Interface Stability Standard
/usr/xpg4/bin/at
ATRIBUTE TYPE ATRIBUTE VALUE
Availability SUNWxcu4
CSI Not enabled
Interface Stability Standard
/usr/bin/batch
ATRIBUTE TYPE ATRIBUTE VALUE
Availability SUNWesu
CSI Enabled
Interface Stability Standard
/usr/xpg4/bin/batch
SunOS 5.11 Last change: 13 Apr 2005 10
User Commands at(1)
ATRIBUTE TYPE ATRIBUTE VALUE
Availability SUNWxcu4
CSI Enabled
Interface Stability Standard
SEE ALSO
auths(1), crontab(1), csh(1), date(1), ksh(1), sh(1),
touch(1), ulimit(1), umask(1), cron(1M), getdate(3C),
authattr(4), shadow(4), queuedefs(4), attributes(5),
environ(5), standards(5)
NOTES
Regardless of queue used, cron(1M) has a limit of 100 jobs
in execution at any time.
There can be delays in cron at job execution. In some cases,
these delays can compound to the point that cron job pro-
cessing appears to be hung. All jobs are executed eventu-
ally. When the delays are excessive, the only workaround is
to kill and restart cron.
SunOS 5.11 Last change: 13 Apr 2005 11
|