<code>at</code> is a shell command

for scheduling commands to be executed once, at a future time. The command was originally developed for use with Unix and is now available on a variety of Unix-like systems, as well as Windows, and ReactOS.

Variants

Unix-like

On Unix-like operating systems, <code>at</code> reads a series of commands from standard input and collects them into one "at-job" which is carried out at a date and time that is specified as part of the command. The job inherits the current environment, so that it is executed in the same working directory and with the same environment variables set as when it was scheduled. <code>at</code> differs from <code>cron</code>, which is used for scheduling recurring execution, e.g., once an hour, every Tuesday, January 1 every year, etc..

As with <code>cron</code>, many Unix systems allow the administrator to restrict access to the <code>at</code> command.  <code>at</code> can be made to send E-mail to a user when done carrying out a scheduled job, can use more than one job queue, and can read a list of commands to execute out from a file instead of standard input. The Linux <code>at</code> command was mostly written by Thomas Koenig.

The <code></code> command can be used instead of to only run scheduled jobs if the system's load average is below a certain value.

Examples

A sample command to compile a C program at 11:45 a.m. on January 31 would be:

<syntaxhighlight lang="console">

$ echo "cc -o foo foo.c" | at 1145 jan 31

</syntaxhighlight>

or

<syntaxhighlight lang="console">

$ at 1145 jan 31

at> cc -o foo foo.c

at> ^D #(press Control-D while at the beginning of a line)

</syntaxhighlight>

The <code>atq</code> program lists the currently queued jobs, while <code>atrm</code> removes jobs from the queue:

<syntaxhighlight lang="console">

$ atq

1234 2011-08-12 11:45 cc -o foo foo.c user

$ atrm 1234

$ atq

$

</syntaxhighlight>

In some Unix-like computer operating systems, it uses a daemon, <code>atd</code>, which waits in the background periodically checking the list of jobs to do and executing those at their scheduled time on behalf of <code>at</code>.

Windows and ReactOS

In addition to the graphical user interface for Windows Task Scheduler in Control Panel, Windows provides an <code>at</code> shell command that schedules operations to run at a specified time and date (similar to <code>cron</code>). It is available since Windows NT, but is now deprecated in favor of <code>schtasks</code>. It can only be used when the Schedule service is running. When used without parameters, <code>at</code> lists scheduled commands.

<code>at</code> cannot access tasks created or modified by Control Panel or <code>schtasks.exe</code>. Also, tasks created with <code>at</code> are not interactive by default; interactivity needs to be explicitly requested.

The ReactOS implementation is based on the Windows implementation. It was developed by Eric Kohl and is licensed under the GPLv2.

  • systemd, incorporates atd

References

Further reading