At

From LQWiki
Jump to navigation Jump to search

The at service allows a command-line task to be executed at a specified future time. Unlike the cron service, at commands are only executed once, and cannot be scheduled to run at a recurring interval.

The at service is controlled by the atd daemon and is installed by default in most distributions.

How to use

  • General usage: at time date - at HH:MM MM/DD/YY - at 12:15 PM today - at 12:15 tomorrow
  • Times and Dates are accepted in several formats 02/01/09 or 02.01.09 - 4:00 pm or 16:00
  • When you enter at with a time and date, you then see the at prompt at>. Enter the commands you want executed, and when done, with your cursor at the beginning of a new line, do a ctrl-d
$ at 12:15 
at> echo "i like linuxquestions.org"
at> ctrl-d
at> <EOT>
job 17 at Tue Aug 11 12:15:00 2009
  • at assumes 'tomorrow' if it is already past the time given and you do not include a date
  • The same could be executed by typing:
echo "i like linuxquestions.org" | at 12:15 tomorrow
  • Using numbers and units

Execute command at this time, 1 week from now

at now + 1 week

4 am 3 days from now

at 4:00 am + 3 days

View Scheduled Jobs

Use the -l option to list the at-queue. Also use the command atq:

at -l
atq

Remove Scheduled Jobs

Use the -d option to remove jobs from the at-queue. Also use the command atrm:

at -d <jobid>
atq <jobid>

See also

External Links

This article is a stub and needs to be finished. Plunge forward and help it grow!