From Gentoo Wiki
Jump to:navigation Jump to:search

This article is a stub. Please help out by expanding it - how to get started.

at is a tool for running delayed jobs and batching processes. Processes can be scheduled via 12 or 24 hour time in HH:MM notation. If that time is already passed, the next day is assumed. It's also possible to specify a job's time with a few different aliases, notably: midnight (00:00), noon (12:00), and teatime (16:00). Relative times are also acceptable.

It is also possible to schedule a job contingent upon acceptable system load via the batch command.


USE flags

USE flags for sys-process/at Queues jobs for later execution

pam Add support for PAM (Pluggable Authentication Modules) - DANGEROUS to arbitrarily flip
selinux !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur


root #emerge --ask sys-process/at

Environment variables

  • LOGNAME — if the user is not logged in at the time of the at job's scheduled execution, mail is sent to the user account specified in this variable.
  • SHELL — used by at at execution time to determine the appropriate shell.


  • /var/spool/at/atjobs — The directory for storing scheduled jobs.
  • /var/spool/at/atspool — The directory for storing the output of completed jobs.
  • /proc/loadavg — The system's load average.
  • /var/run/utmp — Account login records.
  • /etc/at/at.allow — The system whitelist for determining who may submit at batch jobs.
  • /etc/at/at.deny — The system blacklist for preventing abuse of at batch jobs.


The atd service is required in order for at batch job execution to occur. It can be enabled as follows:


root #rc-update add atd default
root #rc-service atd start


root #ln -s /etc/sv/atd /var/service/
root #sv up atd


root #systemctl enable atd
root #systemctl start atd



List scheduled jobs:

user $at -l
10	Mon Mar 20 08:15:00 2023 a alice 
11	Mon Mar 20 09:45:00 2023 a bob

Pipe a simple command to at and have it run in 5 minutes.

user $echo -e "testing, testing, 1, 2, 3" | at now +5 minutes

Delete scheduled jobs:

user $at -r 11


Define the system load below which scheduled jobs are permitted to run. For example, given a 4 core system running batch jobs with a system load of 3.0 might be far more realistic than the 0.8 default.

user $atrun -l 3.0


List scheduled jobs:

user $atq
10	Mon Mar 20 08:15:00 2023 a alice 
11	Mon Mar 20 09:45:00 2023 a bob


Delete a scheduled job:

user $atrm 11


The compile time default for batch is a system load of 0.8, which may not be what you want on a modern multi-core system. To override this compile-time default use the atd -l command.

Run pending batch jobs when the current system load drops below a given threshold.

user $batch


user $at -h
Usage: at [-V] [-q x] [-f file] [-u username] [-mMlbv] timespec ...
       at [-V] [-q x] [-f file] [-u username] [-mMlbv] -t time
       at -c job ...
       at [-V] -l [-o timeformat] [job ...]
       atq [-V] [-q x] [-o timeformat] [job ...]
       at [ -rd ] job ...
       atrm [-V] job ...



root #emerge --ask --depclean --verbose sys-process/at

See also