4.4.3. The at command
The at command executes commands at a
given time, using your default shell unless you tell the command
otherwise (see the man page).
The options to at are rather
user-friendly, which is demonstrated in the examples below:
steven@home:~> at tomorrow + 2 days
warning: commands will be executed using (in order) a) $SHELL
b) login shell c) /bin/sh
at> cat reports | mail myboss@mycompany
at> <EOT>
job 1 at 2001-06-16 12:36
|
Typing Ctrl+D quits
the at utility and generates the
"EOT" message.
User steven does a strange thing here combining two
commands; we will study this sort of practice in
Chapter 5, Redirecting Input and Output.
steven@home:~> at 0237
warning: commands will be executed using (in order) a) $SHELL
b) login shell c) /bin/sh
at> cd new-programs
at> ./configure; make
at> <EOT>
job 2 at 2001-06-14 02:00
|
The -m option sends mail to the user
when the job is done, or explains when a job can't be done. The
command atq lists jobs; perform this command
before submitting jobs in order prevent them from starting at the
same time as others. With the atrm command
you can remove scheduled jobs if you change your mind.
It is a good idea to pick strange execution times, because
system jobs are often run at "round"
hours, as you can see in
Section 4.4.4 the next section.
For example, jobs are often run at exactly 1 o'clock in the morning
(e.g. system indexing to update a standard locate database), so
entering a time of 0100 may easily slow your system down rather
than fire it up. To prevent jobs from running all at the same time,
you may also use the batch command, which
queues processes and feeds the work in the queue to the system in
an evenly balanced way, preventing excessive bursts of system
resource usage. See the Info pages for more information.