at, atq and atrm

Manage jobs for later execution

at    [-V] [-q Q] [-f file] [-mldbv] { time | -t time_arg}
batch [-V] [-q Q] [-f file] [-mv] [time]

at -c job [job]
atq [-V] [-q queue]
atrm [-V] job [job]

at and batch read commands from standard input or a specified file to be executed at a later time .

at timespec executes commands at a specified time.
> at now + 20 minutes -f checkdaily
batch executes commands when system load average drops below 0.8, or the value specified in the invocation of atrun.
 
atq displays jobs in the queue.
% atq
1   Fri Sep 16 11:24:00 2022
For the superuser all jobs are listed in the format:
Job number, date, hour, job class.
atrm job [ job … ] remove jobs, by job number.
atrun run by launchd periodically, if previously loaded by superuser via:
launchctl load -w /System/Library/LaunchDaemons/com.apple.atrun.plist:

Dict { ProgramArguments = Array { /usr/libexec/atrun }
StartInterval = 30
Label = com.apple.atrun
Disabled = true
}

-q queue use queue, a single letter [a-zA-Z]. for running jobs: = . Defaults: a for at and b for batch.
Queues with higher letters run with increased niceness.

A job is submitted to a queue with an uppercase letter is treated as if it had been submitted to batch at that time.
For atq, only show jobs pending in that queue are shown.

-f file Reads the job comands from file rather than standard input.
-m mail is always sent when the job completes
-l at -l list queue.
-d job at -d delete jobs from queue
-v Shows the time verbosly the job will be executed. in the format
"1997-02-20 14:50" unless the environment variable POSIXLY_CORRECT is set; then, it will be
"Thu Feb 20 14:50:00 1997".
-c cats the jobs listed on the command line to standard output.
-t time_arg the job is to be run at the time specified in the same format as specified for the touch(1) ([[CC]YY]MMDDhhmm).
-V prints the version number to standard error.

Time specifications

runs a job no sooner than that time. If already past, runs tomorrow.

A date may follow the time.

Complete description of the time specification is at /usr/share/doc/at-3.1.8/ timespec.

The working directory, the environment (except for $TERM, $DISPLAY and _) and umask are retained from the time of invocation.
A job invoked from a su shell retains the current userid.
The user will be mailed standard error and standard output using /usr/sbin/sendmail.
If at is executed from a su shell, the owner of the login shell will receive the mail.

For other users:
If /etc/at.allow exists, only usernames in it are allowed to use at.
If /etc/at.allow does not exist,
   /etc/at.deny is checked, every username not mentioned in it
If neither exists, only the superuser is allowed use of at.
If /etc/at.denys is empty every user is allowed use these commands, default .

ENVIRONMENT

If unset the login shell will be used.
SHELL settings, environment variables at the time of at invocation are used when the commands are run,
Except: TERM, DISPLAY, SHELLOPTS, _, PPID, BASH_VERSINFO, EUID, UID, GROUPS.
super-user's jobs can use variables that alter the behaviour of the loader such as LD_LIBRARY_PATH

FILES

    /var/spool/at /var/spool/at/spool
       /var/run/utmp
       /proc/loadavg
       /etc/at.allow /etc/at.deny
SEE
cron, nice,bash, umask, atd

Made true HTML and terse by Dennis German