at

NAME

at, atq, atrm - run commands at a later time

SYNOPSIS

at [-mVv] [-f file] [-q queuename] -t time
at [-mVv] [-f file] [-q queuename] timespec
at [-V] -c at_job_id ...
at [-V] -l -q queuename
at [-V] -L -q queuename
at [-V] -l [at_job_id ...]
at [-V] -r at_job_id ...


atq [-Vv] [-q queuename] atrm [-V] at_job_id ...

DESCRIPTION

The at(1) utility submits a shell script or set of commands to be executed at a later time. Commands can be submitted interactively by reading them from standard input, or the -f option can be used to submit a file that contains a set of commands. These commands are stored in a file to be executed at the prescribed time. It is the cron(1) daemon that checks these files and executes them at the appropriate time. Note that for the cron(1) daemon to successfully execute these commands for the user, the user must have previously registered the user's password using crontab -p. Each scheduled job, called an at-job, has a numeric identifier, the at_job_id, which can be used with at(1) to change the job later.

When you submit an at-job using one of the first two forms, at(1) writes the scheduled time and the at_job_id to standard output. The time can be given as an argument to the -t option or as a timespec; the format of the timespec is given later.

The third form of the command (with -r) is used to remove the specified job from the schedule.

The fourth and fifth forms of the command (with -l) list all queued jobs.

OPTIONS

-c at_job_id ...
Copy one or more job files specified by at_job_id to standard output.
-f file
Take the list of commands to be run from file instead of standard output.
-L
List your jobs in a long format, with column titles.
-l
List your jobs. If no at_job_id is specified, list all jobs for the current user; otherwise list information about the specified job or jobs. If -q is also given, list jobs in the specified queue.
-m
Send the user an email notification that the job was run, by electronic mail. The mail includes the standard output and standard error of the job (unless it was redirected elsewhere). If the job produces standard output or standard error, it is mailed to the user whether or not the -m option is given, unless it is redirected elsewhere.
-q queuename
Schedule the job in the specified queue. The queuename can be either a [the default for jobs scheduled with at(1)] or b [for batch jobs scheduled with batch(1)].
-r
Remove one or more specified jobs from the schedule.
-t time
Run the command at the specified time; time has the same format as the time argument to the touch(1) command.
-V
Print version number of program.
-v
Validate time specifications.

When the job runs, it runs in a separate shell (/bin/sh). /bin/sh and the environment variables, current working directory, and other execution-time attributes are the same as when the at(1) command was given.

You can force the job to run in a different shell by explicitly stating the name of the shell. For example, you can invoke at(1) in the Korn shell to run myscript using the C shell:

at now <<eof
csh -c myscript
eof

Since the shell inherits your PATH, you need not specify a full path name (unless the command is not found in your PATH).

The command atq(1) is equivalent to at -L. The command atrm(1) is equivalent to at -r.

Mail to the user is sent using the mailx(1) utility. You can change the mail delivery agent by changing the mail delivery agent for mailx(1) (see the mailx(1) reference page).

The time specification

A time specification includes a time, an optional timezone, and an optional date:

time [timezone] [date]

The time can be given numerically, or as one of the following words: midnight, noon, teatime (4 P.M.), or now.

You can specify the time numerically using a one-, two-, or four-digit number; a one- or two-digit number specifies the hours.

Unless you put AM or PM after the time, time is based on a 24-hour clock. The time 11 is 11:00 AM. The times 11 PM 11:00 PM 23 2300 and 23:00 are all 11:00 PM.

After you have specified the time, you can specify a timezone name. The timezone string is case insensitive. If no timezone is specified, the timezone use is the one specified by the TZ environment variable. The only value currently accepted for the timezone is the string utc (which stands for Universal Time Coordinate).

A date is a month name followed by a day number (optionally followed by a comma and a year number), or a day of the week, or one of the words today or tomorrow. To get a list of valid month names, use the command:

locale -ck mon abmon

To get a list of valid weekday names, use the command:

locale -ck day abday

A time or time and date can also have an increment after it. For example, you could say:
noon+5 minutes
or
midnight Aug 5 + 1 hour

An increment is always +, a number, and one of the following units:

minute, minutes, hour, hours, day, days, week, weeks, month, months, year, or years.

As a special case, you can use the word next instead of +1. For example:

at noon next week

specifies noon in seven days.

DIAGNOSTICS

After successfully queuing, listing, or removing a job or jobs, at(1) returns 0. If an error occurred, at(1) returns >0.

ENVIRONMENT VARIABLES

The at(1) command uses the following environment variables, if set.

SHELL
Specifies the name of the command interpreter used to run the command. Defaults to sh(1).
TZ
The value of the timezone environment variable determines the timezone used.

FILES

The at(1) command uses the following files:

/var/spool/cron/atjobs
The at(1) job directory, containing jobs to be run.

NOTES

Previous implementations of at(1) on Interix used a program called atrun as an interface between at(1) and the system scheduler cron(1). This interface is no longer needed, and has been removed. If you have crontab files that contain an entry for atrun, remove that entry.

By default, Interix does not execute files with the set-user-ID (setuid) or set-group-ID (setgid) mode bit set for security reasons. If an attempt is made to execute such a file, the ENOSETUID error is returned. For more information and and instructions for enabling execution of files with these mode bits set, see The superuser account and appropriate privileges in Windows Services for UNIX Help.

SEE ALSO

batch(1)

cron(1)

crontab(1)

locale(1)

touch(1)