cron
. The at
command, however, runs a program at one specified time.The batch command executes commands entered from standard input. This command functions much like the
at
command, but does not bog down the system.
Use Unix at command like cron
You can use the
at
command in much the same way as cron
.
What is the difference? Whereas you use cron
to run a program over time repeatedly, you can use the at
command to run a command at one specified time.
The syntax for at
is
at options time date
Options for the
at
command include:-f
, which allowsat
to execute commands inside a text file-m
, which sends an email to the person who scheduled theat
command upon completion of the task
You should use a specific time format. For example, if you want to schedule a series of commands contained in the file trail.sh to run at 6:30 p.m., you would enter
at -f trial.sh 0630pm
To obtain a listing of scheduled events, use the
atq
command. This command also has several options:-c
will sort the list according to when the list was generated by theat
command.-n
will display a numbered list ofat
events.
atrm
command and provide the proper number for the at
entry. If you do not know the number, you can first issue the atq
command. You will then receive a message such as
1 1999-06-14 18:30 a
This message informs you that you have one command prepared to execute. To remove it, enter
atrm 1
If you have multiple commands in line to execute, enter the number of the command you want to delete from the list. For example,
atrm 1
deletes the first command, atrm 7deletes the seventh command, and so forth.
Unix batch Command
Thebatch
command executes commands entered from standard input. This command functions much like the at
command. However, one key difference exists: at
can execute several commands at once, running them in the background. This operation can consume valuable system resources and bog down the server. The batch
command runs one process, waits for it to end, then runs another. This empowers the operating system to run batch jobs and tasks at its own discretion, rather than being forced to run
them at a specific time. The command syntax for batch
is as follows:
batch task list CTRL+D
Although you can issue commands to view
crontab
and at
entries, you must rely on email to receive output for the batch
command.
Batch Processes
Batch processes are not associated with any terminal. Rather, they are submitted to a queue, from which jobs are executed sequentially.
Unix offers a very primitive batch command, but vendors whose customers require queuing have generally implemented something more substantial. Some of the best known are the (NQS) Network Queuing System[4], developed by NASA and used on many high-performance computers including Crays, as well as several network-based process-scheduling systems from various vendors.
These facilities usually support heterogeneous as well as homogeneous networks, and they attempt to distribute the aggregate CPU load evenly among the workstations in the network, a process known as load balancing or load leveling.