at, batch
PURPOSE
Runs commands at a later time.
SYNOPSIS
at time [ date ] [ + increment ]
at -l [ job ... ]
at -r job ...
batch
DESCRIPTION
The at and batch commands read from standard input the
names of commands to be run at a later time:
o at allows you to specify when the commands should be
run.
o batch runs jobs when the system load level permits.
Both at and batch mail you all output from standard
output and standard error for the scheduled commands,
unless you redirect that output. They also write the job
number and the scheduled time to standard error.
Variables in the shell environment, the current direc-
tory, umask, and ulimit are retained when the commands
are run. Open file descriptors, traps, and priority are
lost.
You can use at if your name appears in the file
/usr/lib/cron/at.allow. If that file does not exist, at
checks the file /usr/lib/cron/at.deny to determine if you
should be denied access to at. If neither file exists,
only the superuser can submit a job. The allow/deny
files contain one user name per line. If at.allow does
exist, the superuser's login name must be included in it
for the superuser to be able to use the command.
The required time parameter can be one of the following:
1. A number followed by an optional suffix. at inter-
prets one- and two-digit numbers as hours. It inter-
prets four digits as hours and minutes. The NLTIME
environment variable specifies the order of hours and
minutes. The default order is the hour followed by
the minute. You can also separate hours and minutes
with a : (colon). The default order is hour:minute.
In addition, you may specify a suffix of am, pm, or
zulu. If you do not specify am or pm, at uses a 24
hour clock. The suffix zulu indicates that the time
is GMT (Greenwich Mean Time). The NLTMISC environ-
ment variable controls the suffixes that at recog-
nizes.
2. at also recognizes the following keywords as special
times: noon, midnight, and now. Note that you can
use the special word now only if you also specify a
date or an increment. Otherwise, at tells you: "too
late". The NLTSTRS environment variable controls the
additional keywords that at recognizes.
You may specify the date parameter as either a month name
and a day number (and possibly a year number preceded by
a comma), or a day of the week. The NLDATE environment
variable specifies the order of the month name and day
number (by default, month followed by day). The NLLDAY
environment variable specifies long day names; NLSDAY and
NLSMONTH specify short day and month names. (By default,
the long name is fully spelled out; the short name abbre-
viated to three characters.) at recognizes two special
"days," today and tomorrow by default. (The NLTSTRS
environment variable specifies these special days.)
today is the default date if the specified time is later
than the current hour; tomorrow is the default if the
time is earlier than the current hour. If the specified
month is less than the current month (and a year is not
given), next year is the default year. The optional
increment can be one of the following:
1. A + (plus sign) followed by a number and one of the
following words: minute[s], hour[s], day[s],
week[s], month[s], year[s] (or their non-English
equivalents).
2. The special word next followed by one of the fol-
lowing words: minute[s], hour[s], day[s], week[s],
month[s], year[s] (or their non-English equivalents).
The NLTUNITS environment variable specifies the non-
English equivalents of the English defaults.
FLAGS
-l Reports your scheduled jobs.
-r job . . . Removes jobs previously scheduled by at
or batch, where job is the number
assigned by at or batch. If you do not
have superuser authority (see "su"), you
can remove only your own jobs.
EXAMPLES
1. To schedule the command from the terminal, use a
command similar to one of the following:
at 5 pm Friday uuclean
Ctrl-D
at now next week uuclean
Ctrl-D
at now + 2 days uuclean
Ctrl-D
2. To run uuclean at 3:00 in the afternoon on the 24th
of January, use any one of the following commands:
echo uuclean | at 3:00 pm January 24
echo uuclean | at 3pm Jan 24
echo uuclean | at 1500 jan 24
3. To run a job when the system load permits:
batch <<!
longjob 2>&1 >outfile | mail myID
!
This example shows the use of a here document to send
standard input to at (see "Inline Input Documents").
The order of redirections is important here, so that
only error messages are sent into the pipe to the
mail command. If you reverse the order, both
standard error and standard output are sent to
"outfile" (see the discussion of "Input and Output
Redirection Using File Descriptors" for details).
4. To have a job reschedule itself, invoke at from
within the shell procedure by including code similar
to the following within the shell file:
echo "sh shellfile" | at now tomorrow
5. To list the jobs you have sent to be run later:
at -l
6. To cancel jobs:
at -r 103 227
This cancels jobs "103" and "227". Use at -l to list
the job numbers assigned to your jobs.
FILES
/usr/lib/cron Main cron directory.
/usr/lib/cron/at.allow List of allowed users.
/usr/lib/cron/at.deny List of denied users.
/usr/spool/cron/atjobs Spool area.
RELATED INFORMATION
The following commands: "cron," "kill," "mail, Mail,"
"nice," "ps," and "sh."
The environment special facility in AIX Operating System
Technical Reference.
"Running Commands at Pre-set Times" and "Overview of
International Character Support" in IBM RT PC Managing
the AIX Operating System.