4 Running One-Time Tasks

Use the at and batch commands for the atd service to schedule one-time tasks

Before using these commands, ensure that the at service is running:

sudo systemctl is-active atd

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

To schedule a task to run one time only at a specified tine, use the at command.

For example, to schedule a job to run the script at $HOME/atjob to run in 20 minutes time, run the following command:

at now + 20 minutes < $HOME/atjob
job 1 at 2025-06-13 11:25

To schedule a batch job to run when the system load average is light, use the batch command.

For example, to run a batch job to run the script at $HOME/batchjob when the system load average is less than 0.8, run the following command:

batch < batchjob
job 2 at 2025-06-13 11:31

Note:

The system load average threshold under which you can schedule user-defined batch jobs to run is 0.8, by default. For more information about how that value can vary, see Changing the Behavior of Batch Jobs.

To list all the scheduled one-time jobs that are in queue, run the following command:

sudo atq
job 1 at 2025-06-13 11:25
job 2 at 2025-06-13 11:31

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

sudo atrm 2