AT(1)

NAME
at, batch - queue, examine or delete jobs for later execution

SYNOPSIS
at [-bm] [-f file] [-l [job ...]] [-q queue] -t time_arg | timespec
at -c | -r job ...
batch [-m] [-f file] [-q queue] [timespec]

DESCRIPTION
at and batch read commands from standard input or a specified file which are to be executed at a later time, via the user's shell as specified by the SHELL environment variable. If SHELL is not set, the shell in the user's password database entry is used instead. If all else fails, sh(1) will be used.

The related programs are as follows:

at  Executes commands at a specified time.

batch
    Executes commands when system load levels permit. In other words, when the load average drops below 1.5, or the value specified in the invocation of cron(8).

The options are as follows:

-b  An alias for batch.

-c job ...
    Prints the jobs listed on the command line to standard output.

-f file
    Reads the job from file rather than standard input.

-l [job ...]
    Displays the queue of jobs which are currently awaiting execution. If a job argument is specified, only the specified jobs will be displayed. Unless the user is the superuser, only the user's own jobs will be displayed.

-m  Send mail to the user when the job has completed, even if there was no output.

-q queue
    Uses the specified queue. A queue designation consists of a single letter. Valid queue designations range from a to z and A to Z. The c queue is the default for at and the E queue for batch. Queues with higher letters run with increased niceness. If a job is submitted to a queue designated with an uppercase letter, it is treated as if it had been submitted to batch at that time. If the user specified the -l option and at is given a specific queue, only jobs pending in that queue will be shown.

-r job ...
    Remove the specified job(s) from the at queue.

-t time_arg
    Specify the job time. The argument should be of the form [[cc]yy]mmddHHMM[.SS] (matching touch(1)'s -t format), where the parts of the argument represent the following:

    ccyy
        Year. If yy is specified, but cc is not, a value for yy between 69 and 99 results in a cc value of 19. Otherwise, a cc value of 20 is used.
    mm  Month: a number from 1 to 12.
    dd  Day: a number from 1 to 31.
    HH  Hour: a number from 0 to 23.
    MM  Minute: a number from 0 to 59.
    SS  Second: a number from 0 to 60 (permitting a leap second), preceded by a period. The default is 0.

timespec
    As well as the -t option, at alternatively allows some moderately complex timespec specifications. It accepts times of the form HHMM or HH:MM to run a job at a specific time of day (if that time is already past, the next day is assumed). It is also possible to specify midnight, noon, now, or teatime (4pm), or have a time-of-day suffixed with AM or PM for running in the morning or the evening. To say what day the job will be run, give a date in the form month-name day with an optional year, or giving a date of the form dd.mm.ccyy, dd.mm.yy, mm/dd/ccyy, mm/dd/yy, mmddccyy, or mmddyy.

    The year may be given as two or four digits. If the year is given as two digits, it is taken to occur as soon as possible in the future, which may be in the next century — unless it's last year, in which case it's considered to be a typo.

    The specification of a date must follow the specification of the time of day. A time like [now] + count time-units may be given, where the time-units can be minutes, hours, days, weeks, months, or years (the singular forms are also accepted). To tell at to run the job today or tomorrow, suffix the time with today or tomorrow. The next keyword may be used as an alias for + 1.

    For example, to run a job at 4pm three days from now, use at 4pm + 3 days. To run a job at 10:00am on July 31, use at 10am Jul 31. To run a job at 1am tomorrow, use at 1am tomorrow. To run a job at midnight in one week's time, use at midnight next week.

For both at and batch, commands are read from standard input (or the file specified with the -f option) and executed. The working directory, the environment (except for the variables BASH_VERSINFO, DISPLAY, EUID, GROUPS, PPID, SHELLOPTS, SSH_AGENT_PID, SSH_AUTH_SOCK, TERM, TERMCAP, UID, and _), and the umask are retained from the time of invocation. An at or batch command invoked from a su(1) shell will retain the current user ID. The user will be mailed standard error and standard output from his commands, if any. If at is executed from a su(1) shell, the owner of the login shell will receive the mail.

For non-root users, permission to run at is determined by the files /var/cron/at.allow and /var/cron/at.deny. Note: these files must be readable by group crontab (if they exist).

If the file /var/cron/at.allow exists, only usernames mentioned in it are allowed to use at. If /var/cron/at.allow does not exist, /var/cron/at.deny is checked. Every username not mentioned in it is then allowed to use at. If neither exists, only the superuser is allowed to run at.

An empty /var/cron/at.deny means that every user is allowed to use these commands. This is the default configuration.

FILES
/var/cron/atjobs
    directory containing job files
/var/cron/at.allow
    allow permission control
/var/cron/at.deny
    deny permission control

EXIT STATUS
The at utility exits with one of the following values:

0   Jobs were successfully submitted, removed, or listed.
>0  An error occurred.

SEE ALSO
atq(1), atrm(1), nice(1), sh(1), touch(1), umask(2), cron(8)

STANDARDS
The at and batch utilities are compliant with the p1003.1-2024 specification.

The at flags [-bc] and the teatime timespec are extensions to that specification.

p1003.1-2024 states that batch is equivalent to running "at -q b -m now". This implementation permits a timespec argument, as well as the ability to read from a file (-f) and specify a job queue (-q), and does not send mail to the user (-m) by default.

By default, p1003.1-2024 schedules at jobs in queue a and batch jobs in queue b.

The at.allow/deny mechanism is marked by p1003.1-2024 as being an X/Open System Interfaces option.

AUTHORS
-nosplit at was mostly written by Thomas Koenig <ig25@rz.uni-karlsruhe.de>. The time parsing routines are by David Parsons <orc@pell.chi.il.us>.

BUGS
at and batch as presently implemented are not suitable when users are competing for resources.