AT(1)

NAME
at, batch - execute a command or script at a specified time

SYNOPSIS
at [ -csm ] [ -qqueue ] time [ date ] [ + increment ]
[ script ]
at -r jobs...
at -l [ jobs... ]

batch [ -csm ] [ script ]

DESCRIPTION
at and batch read commands from standard input to be executed at a later time. at allows you to specify when the commands should be executed, while jobs queued with batch will execute as soon as the system load level permits. script is the name of a file to be used as command input for the Bourne shell, sh(1), the C shell, csh(1), or an arbitrary shell specified by the SHELL environment variable. If script is omitted, command input is accepted from the standard input.

Standard output and standard error output are mailed to the user unless they are redirected elsewhere. The shell environment variables, current directory, and umask(2V) are retained when the commands are executed. Open file descriptors, traps, and priority are lost.

Users are permitted to use at if their name appears in the file /var/spool/cron/at.allow. If that file does not exist, the file /var/spool/cron/at.deny is checked to determine if the user should be denied access to at. If neither file exists, only the super-user is allowed to submit a job. If at.deny is empty, global usage is permitted. The allow/deny files consist of one user name per line.

The time may 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 may alternately be specified as two numbers separated by a colon, meaning hour:minute. A suffix am or pm may be appended; otherwise a 24-hour clock time is understood. The suffix zulu may be used to indicate GMT. The special names noon, midnight, now, and next are also recognized.

An optional date may be specified as either a month name followed by a day number (and possibly year number preceded by an optional comma) or a day of the week (fully spelled 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 optional increment is simply a number suffixed by one of the following: minutes, hours, days, weeks, months, or years. (The singular form is also accepted.)

Thus legitimate commands include:

    at 0815am Jan 24
    at 8:15am Jan 24
    at now + 1 day
    at 5 pm Friday

at and batch write the job number and schedule time to standard error.

batch submits batch jobs to queue b; this ``batch'' queue is for jobs to be run as soon as possible. A job submitted to b is scheduled to run immediately and its arguments will not be interpreted as time, date, or + increment.

batch is similar to `at now', but does not, for example, go into the same queue or respond with the error message `too late'.

OPTIONS

-c  C shell. csh is used to execute script.

-s  Standard (Bourne) shell. sh is used to execute the job. By default, the SHELL environment variable determines which shell to use.

-m  Mail. Send mail after the job has been run, even if the job completes successfully.

-qqueue
    Submit the job in queue queue rather than the default queue a. The valid queues are a through z. batch submits jobs in queue b. Queue c is reserved for cron(8) and jobs cannot be submitted to that queue.

-r jobs ...
    Remove the specified jobs previously scheduled by at or batch. The job numbers are the numbers of the jobs given to you previously by the at or batch commands. You can only remove your own jobs unless you are the super-user.

-l [jobs ...]
    If jobs is specified, print the queue entry for those jobs; if jobs is not specified, print the queue entries for all jobs for the user.

ENVIRONMENT
If neither at.allow nor at.deny exists, only the super-user is allowed to submit a job. If at.deny is present, but empty, global usage is permitted. The allow/deny files consist of one user name per line.

EXAMPLES
Unless a script is specified, the at and batch commands read from standard input the commands to be executed at a later time. sh and csh provide different ways of specifying standard input. Within your commands, it may be useful to redirect standard output.

This sequence can be used at a terminal:

    batch
    nroff filename > outfile
    CTRL-D (hold down `control' and depress `D')

This sequence, which demonstrates redirecting standard error to a pipe, is useful in a shell procedure (the sequence of output redirection specifications is significant):

    batch <<!
    nroff filename 2>&1 > outfile | mail loginid
    !

To have a job reschedule itself, invoke at from within the shell procedure, by including code similar to the following within the shell file:

    at 1900 thursday next week shellfile

FILES
/var/spool/cron
    main cron directory
/var/spool/cron/at.allow
    list of allowed users
/var/spool/cron/at.deny
    list of denied users
/var/spool/cron/atjobs
    spool area

SEE ALSO
atq(1), atrm(1), csh(1), kill(1), mail(1), nice(1), ps(1), sh(1), umask(2V), cron(8)

DIAGNOSTICS
Complaints about various syntax errors and times out of range.

BUGS
If the system crashes, mail stating that the job was not completed is not sent to the user.

Shell interpreter specifiers (such as, !/bin/csh) in the beginning of script are ignored.