8.4 Running One-time Tasks

You can use the at command to schedule a one-time task to run at a specified time, or the batch command to schedule a one-time task to run when the system load average drops below 0.8. The atd service must be running to use at or batch.

# service atd status
atd (pid  2078) is running...

at takes a time as its argument and reads the commands to be run from the standard input. For example, run the commands in the file atjob in 20 minutes time:

# at now + 20 minutes < ./atjob
job 1 at 2013-03-19 11:25

The atq command shows the at jobs that are queued to run:

# atq
1	2013-03-19 11:25 a root

The batch command also reads command from the standard input, but it does not run until the system load average drops below 0.8. For example:

# batch < batchjob
job 2 at 2013-03-19 11:31

To cancel one or more queued jobs, specify their job numbers to the atrm command, for example:

# atrm 1 2

For more information, see the at(1) manual page.