< Previous | Contents | Next >
Printing files is discussed in Chapter 8.
Programmers often use the sleep command to halt script or program execution for a certain time.
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
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
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.