Today we have something simple that actually is a bit complicated to
explain . . . . . it is about the command "at". This command "at" lets
you execute a command or script at a later time, you can set the time
in many different ways and even have the result mailed to you after the
command has been executed.

Now, using "at" is not only just typing the command and hitting the
enter-key . . . there is a little more to it, so let me give an
example. In the example we want to have the command "play
/usr/share/sounds/KDE_Startup.wav" executed at 12:49 . . . . have a
look what I see in the terminal:

- On the 1st line you see the command "at 12:49 -m", meaning execute at
12:49 and the "-m" means mail me when the job is finished.
- On the 2nd line it will print some info about the at command and jump
to line 3
- On the 3rd line you will see the "at>" prompt, at the "at>"
prompt you type the command you want to have executed and you hit the
enter-key again.
- On the 4th line you get the "at>" prompt appearing again, this
time you press Ctrl+D and it will print <EOT>
- The 5th it will then automatically print the job number and the time
the given command will be executed.

Next example: here we have a script "/usr/local/bin/backup-script" that
we want executed at 12:32 . . . . Again, have a look what I see in the
terminal:

On the 1st line you see "at 12:32 -m" like in our first example .
. but after that comes "-f" meaning "from file" and
"/usr/local/bin/backup-script" which is the path to the file/script I
want to have executed.
On the 2nd and 3rd line you see the same as we saw on line 2 and 5 of
our first example.

Okay . . hold on, we are almost there . . . . remember the job numbers?
Well, they can come handy if you want to cancel the job before it runs.
First we use either "at -l" or "atq" to list the pending jobs:

QUOTE

$ at -l7
2006-05-01 12:49 a bruno8
2006-05-01 12:32 a root

And we see the number of the first job is "7" . . . . now we
remove that job with

CODE

$ atrm 7

Good . . . . now before I close off there is one last point I would
like you to look at and that is the vast amount of different time
formats you can use with the command "at" . . here is from the man-page:

QUOTE

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 spe-
cific time of day. (If that
time is already past, the next day is
assumed.) You
may also specify midnight, 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
MMDDYY or MM/DD/YY or DD.MM.YY. The specifi-
cation 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.

For example, to run a job at 4pm
three days from now, you would do at
4pm + 3 days, to run a
job at 10:00am on July 31, you would do at 10am
Jul 31 and to run a job at 1am
tomorrow, you would do at 1am tomorrow.