AT(1)
NAME
at, batch − execute commands at a later time
SYNOPSIS
at [ −qqueue ] time [ date ] [[ next | +increment ] time_designation ] job ...
at −r job ...
at −l [ job ... ]
batch
DESCRIPTION
At and batch read commands from standard input to be executed at a later time. At allows you to specify when the commands are to be executed. Jobs queued with batch execute when system load level permits. The −q option specifies which queue the job should be submitted to (see queuedefs(4)). Queues a through y (except c) can be used. At uses queue a by default. All queues require a time designation except for queue b which runs as soon as system load level permits. At −r removes jobs previously scheduled with at. The −l option reports all jobs scheduled for the invoking user.
Standard output and standard error output are mailed to the user unless they are redirected elsewhere. The shell environment variables, current directory, umask (see umask(1)) and ulimit (see ulimit(2)) are retained when the commands are executed (see proto(4)). Open file descriptors, traps, and priority are lost.
Only users whose names appear in file /usr/lib/cron/at.allow can run at. If that file does not exist, file /usr/lib/cron/at.deny is checked to determine if the user should be denied access to at. If neither file exists, only root is allowed to submit a job. If only at.deny exists but is empty, global usage is permitted. The allow/deny files consist of one user name per line.
The argument time can be specified as one, two, or four digits. One- and two-digit numbers represent hours; four digits are hours and minutes. Alternately, time can be specified as two numbers separated by one of the following characters: : , ’ , h , . or , . If defined in langinfo(3C), special time unit characters can be used. A suffix am or pm can be appended. Otherwise a 24-hour clock time is understood. For example, 8:15, 8’15, 8h15, 8.15 and 8,15 are read as 15 minutes after 8 in the morning. The suffix zulu can be used to indicate GMT. The special names noon, midnight, now, and next are also recognized.
An optional argument date can be specified as either a day of the week (fully spelled out or abbreviated) or a date consisting of a day, a month, and optionally a year. The day and year fields must be numeric, and the month can be either fully spelled out, abbreviated, or numeric. These three fields can be in any order, and separated by punctuation marks such as /, -, . or ,. If defined in langinfo(3C), special date unit characters can be present. Two special “days”, today and tomorrow, are also recognized. 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. If a given date is ambiguous (such as 2/5), the D_T_FMT string (if defined in langinfo(3C)) is used to resolve the ambiguity.
The optional argument next, followed by a time_designation of minutes, hours, days, weeks, months, or years, lets the user schedule a task to be executed when the specified time_designation has elapsed. A numerical operator, +increment, enables the user to schedule the task several hours, days, weeks, months, or years in advance. (See EXAMPLES.) The next argument is equivalent to +1 increment. Both plural and singular forms of time_designation are accepted.
The words today, tomorrow, noon, midnight, now, minutes, hours, days, weeks, months, years and their singular forms are replaced by the local language equivalent (see EXTERNAL INFLUENCES below).
At and batch write the job number and schedule time to standard error.
Batch submits a batch job. It is similar to at now, but with the following differences: batch goes into a different queue; at now responds with error messages.
At −r removes jobs previously scheduled by at or batch. The job number is the number returned by the at or batch command. You can also get job numbers by typing at −l. You can remove only your own jobs unless you are the superuser.
RETURN VALUE
Exit code 0 is returned upon successful completion, otherwise 1 is returned.
DIAGNOSTICS
At complains about syntax errors and out-of-range times.
If the given time is equal to the current time (in hours and minutes), at returns an error message that reads "too late."
If login shell is not /bin/sh, at produces a warning message as a reminder that at jobs are executed using /bin/sh.
EXAMPLES
The at and batch commands read from standard input the commands to be executed at a later time. Sh(1) provides different ways of specifying standard input. Within your commands, it may be useful to redirect standard output.
The following sequence can be used at a terminal to redirect output:
batch
nroff filename >outfile
<control-D>
This sequence demonstrates redirecting standard error to a pipe and is useful in a shell procedure. Note that the sequence of output redirection specifications is significant:
batch <<! nroff filename 2>&1 >outfile | mail loginid !
To perform a task at 5:00 am next Tuesday, use
at 500 tuesday next week
To perform a task at 5:00 am one week from Tuesday (that is, 2 Tuesdays in advance) use
at 500 tuesday + 2 weeks
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 1900 thursday next week
The following commands show several forms recognized by at and include native language usage:
at 0815 Jan 24
at 8:15 Jan 24
at 9:30am tomorrow
at now + 1 day
at 5 pm Friday
| at 17:40 Tor. | /* in Danish */ | ||
| at 17h46 demain | /* in French */ | ||
| at 5:30 26. Feb. 1988 | /* in German */ | ||
| at 12:00 26-02 | /* in Finnish */ |
WARNINGS
If the date argument begins with a number and the time argument is also numeric without suffix, the time argument should be a four-digit number that can be correctly interpreted as hours and minutes.
Do not use both next and + increment within a single at command; only the first operator is accepted and the trailing operator is ignored. No warning or error is produced.
AUTHOR
At was developed by AT&T and HP.
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
/usr/lib/cron/queuedefs scheduling information
/usr/lib/cron/.proto prototype information
SEE ALSO
cron(1M), crontab(1), queuedefs(4), proto(4), kill(1), mail(1), nice(1), ps(1), sh(1), hpnls(5).
EXTERNAL INFLUENCES
Environment Variables
LC_TIME determines the format and contents of date and time strings.
LANG determines the translation of the words today, tomorrow, noon, midnight, now, minutes, hours, days, weeks, months, years, next, and their singular forms. LANG also determines the language in which messages are displayed.
If LC_TIME is not specified in the environment or is set to the empty string, the value of LANG is used as a default for each unspecified or empty variable. If LANG is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of LANG. If any internationalization variable contains an invalid setting, at behaves as if all internationalization variables are set to "C". See environ(5).
International Code Set Support
Single- and multi-byte character code sets are supported.
STANDARDS CONFORMANCE
at: SVID2, XPG2, XPG3
batch: SVID2, XPG2, XPG3
Hewlett-Packard Company — HP-UX Release 7.0: Sept 1989