DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Controlling processes

Running processes at some time in the future

You can run commands at an arbitrary time in the future[1] by using the at(C) and batch(C) commands. at allows you to specify a time when the command should be executed, and batch executes the command when the system load level permits. The at command uses the format at sometime command where sometime is a time and date in the future when command will be executed. at is useful for sending yourself reminders, for example:

   $ at 1:00pm Jan 24
   mail -s "Technical Publications meeting at 1:15" jdixon
   <Ctrl>D
   job 782560800.a at Mon Jan 24 13:00:00 BST 1994
   $
This command sends a blank mail message entitled Technical Publications meeting at 1:15 to jdixon at 1:00P.M. on January 24.

at allows times and dates to be specified in a wide variety of ways. See at(C) for details.

To display a list of current at jobs, type at -l. To remove at jobs and their identification numbers, type at -r job_id; to delete the at job queued in the last example, enter the following:

   $ at -r 782560800.a
Note that the trailing ``.a'' must be specified. This distinguishes at jobs from batch jobs, which have a trailing ``.b''.

batch takes no arguments and submits a command for immediate execution at lower priority than an ordinary at command. For example:

   $ batch
   compress *.txt
   <Ctrl>D
   $
This command compresses all the files ending in .txt in the current directory. The job will be executed when the load on the system permits.

The at and batch commands are available only to users whose user names appear in the /usr/lib/cron/at.allow file: users who are specifically barred from using these facilities appear in /usr/lib/cron/at.deny. These files are editable only by the root user.


Footnotes

[1]
The UNIX system's idea of time starts at the ``Epoch'', January 1, 1970. The largest number representable by a 32-bit signed integer is 2147483647: add this number of seconds to the Epoch, and you get a date in the year 2037. On systems that implement dates in this way, 2037 is the UNIX system time horizon: representing dates as unsigned 32-bit integers, or even as 64-bit integers, would obviously enhance the UNIX system's grasp of the future.

Next topic: Executing processes at regular intervals
Previous topic: Scheduling your processes

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005