batch Command

Purpose

Runs jobs when the system load level permits.

Syntax

batch

Description

The batch command reads from standard input the names of commands to be run at a later time and runs the jobs when the system load level permits. The batch command mails you all output from standard output and standard error for the scheduled commands, unless you redirect that output. It also writes the job number and the scheduled time to standard error.

When the batch command is executed, it retains variables in the shell environment, and the current directory; however, it does not retain open file descriptors, traps, and priority.

The batch command is equivalent to entering the at -q b -m now command. The -q b flag specifies the at queue for batch jobs.

Exit Status

This command returns the following exit values:

Item Description
0 Successful completion
>0 An error occurred.

Examples

To run a job when the system load permits, enter:

batch <<!
longjob
!

This example shows the use of a "Here Document" to send standard input to the batch command.

Files

Item Description
/usr/bin/batch Contains the batch command.
/bin/batch Symbolic link to the batch command.
/var/adm/cron Indicates the main cron daemon directory.
/var/spool/cron/atjobs Indicates the spool area.