When you have questions such as this always consult the man pages. They can be very enlightening.
What it does
excerpt from at man page
NAME
at, batch, atq, atrm - queue, examine or delete jobs for later execution
DESCRIPTION
at and batch read commands from standard input or a specified file
which are to be executed at a later time, using /bin/sh.
Usage
The usage of the tools:
Usage: at [-V] [-q x] [-f file] [-mldbv] timespec ...
at [-V] [-q x] [-f file] [-mldbv] -t time
at -c job ...
atq [-V] [-q x]
atrm [-V] job ...
batch
at
includes 4 commands (at
, atq
, atrm
, and batch
). You use at
and batch
to schedule the jobs, atq
to see what's scheduled, and atrm
to remove a job prior to it running.
$ at -f <cmd> timspec
Timespec
The time to run the at
job can be specified in different ways.
excerpt form at man page
At allows fairly complex time specifications, extending the POSIX.2
standard. It accepts times of the form HH:MM to run a job at a
specific time of day. (If that time is already past, the next day is
assumed.) You may also specify mid‐ night, noon, or teatime (4pm) and
you can have a time-of-day suffixed with AM or PM for running in the
morning or the evening. You can also say what day the job will
be run, by giving a date in the form month-name day with an optional
year, or giving a date of the form MMDD[CC]YY, MM/DD/[CC]YY,
DD.MM.[CC]YY or [CC]YY-MM-DD. The specification of a date must
follow the specification of the time of day. You can also give times
like now + count time-units, where the time- units can be minutes,
hours, days, or weeks and you can tell at to run the job today by
suffixing the time with today and to run the job tomorrow by suffixing
the time with tomorrow.
Examples
Say you have this shell script.
$ cat mycrontest.sh
#!/bin/bash
echo "It is now $(date +%T) on $(date +%A)"
Sample run:
$ ./mycrontest.sh
It is now 18:37:42 on Friday
Sample at job submissions:
$ at -f mycrontest.sh 10pm tomorrow
job 14 at Sun Jul 8 22:00:00 2007
$ at -f mycrontest.sh 2:00 tuesday
job 15 at Tue Jul 10 02:00:00 2007
$ at -f mycrontest.sh 2:00 july 11
job 16 at Wed Jul 11 02:00:00 2007
$ at -f mycrontest.sh 2:00 next week
job 17 at Sat Jul 14 02:00:00 2007
References
at
retains your environment the way it was when the job was scheduled: same working directory, environment variables, ... – Carlos Campderrós Oct 28 '13 at 10:19batch
, which is nearly identical toat
, but will wait for a low load instead, and apparently,at -q z
will nice the job by itself, whereasat -q Z
will wait for the time, then wait for load to drop, and nice the job as well. Wow, what a load of seldom-used features! – Ulrich Schwarz Oct 28 '13 at 12:29cron
, it is also good to point out thatat
(andbatch
) are (or were) actually part ofcron
– David G. Sep 20 '20 at 21:10