Job scheduling using the batch command, Job scheduling using the crontab command – HP NonStop G-Series User Manual

Page 145

Advertising
background image

where job-numbers is one or more assigned job numbers assigned by at. For example, the
following command cancels three jobs:

$ at -r 127448231.a 127448246.a 127451526.a

Job Scheduling Using the batch Command

The batch command is actually a special form of the at command that submits a job to a special
batch input queue that is executed at a time when the level of system activity allows.

The batch command reads the commands to be executed from the standard input file (the terminal).
You enter one command on each line, followed by the EOF character to indicate the end of the
command sequence. For example, the following batch command submits three OSS commands
to be executed at a system-determined time:

$ batch

c89 sfile.c -o bfile

bfile p1 p2 outfile

lp outfile

<EOF>

648281200.b

After you enter the EOF character, the batch command assigns a job number to the job and
schedules the job for later execution. Note that the job is assigned to queue b, the batch input
queue.

You can use redirection to submit a file containing OSS commands to the batch command, as in
the following example (where filea contains OSS commands):

$ batch < filea

648281344.b

You can use the at command with the -l or -r flag to display of list of scheduled batch jobs or
to cancel a batch job. See

“Displaying a List of Scheduled Jobs (at -l)” (page 144)

and

“Canceling

a Scheduled Job (at -r)” (page 144)

Job Scheduling Using the crontab Command

The crontab command provides a way to schedule jobs that are to be executed on a recurring
basis. crontab is used primarily by system administrators to perform various system-related
housekeeping tasks that need to be done periodically, such as cleaning up the file system, sending
automatic reminders, collecting and archiving system accounting information, and so on.

The crontab command copies a configuration file, or crontab file, from your current directory
to a directory containing all users’ crontab files. The crontab file contains the commands to be
executed and instructions indicating when the commands are to be executed. The cron demon,
a program that runs continuously in the background, scans the crontab files and executes the
commands according to the instructions provided.

You create a crontab file using a text editor such as vi. A crontab file consists of one or more
entries having the following format:

minute hour day month weekday command

where

minute

is the minute (0 through 59) at which the command will be executed.

hour

is the hour (0 through 23) of execution.

day

is the day of the month (0 through 31) of execution.

Scheduling Jobs

145

Advertising
This manual is related to the following products: