35.2.2. Configuring Batch Jobs

35.2.2. Configuring Batch Jobs

To execute a one-time task when the load average is below 0.8, use the batch command.

After typing the batch command, the at> prompt is displayed. Type the command to execute, press Enter, and type Ctrl-D . Multiple commands can be specified by typing each command followed by the Enter key. After typing all the commands, press Enter to go to a blank line and type Ctrl-D . Alternatively, a shell script can be entered at the prompt, pressing Enter after each line in the script, and typing Ctrl-D on a blank line to exit. If a script is entered, the shell used is the shell set in the user's SHELL environment, the user's login shell, or /bin/sh (whichever is found first). As soon as the load average is below 0.8, the set of commands or script is executed.

If the set of commands or script tries to display information to standard out, the output is emailed to the user.

Use the command atq to view pending jobs. Refer to Section 35.2.3, “Viewing Pending Jobs” for more information.

Usage of the batch command can be restricted. For more information, refer to Section 35.2.5, “Controlling Access to At and Batch” for details.


Note: This documentation is provided {and copyrighted} by Red Hat®, Inc. and is released via the Open Publication License. The copyright holder has added the further requirement that Distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder. The CentOS project redistributes these original works (in their unmodified form) as a reference for CentOS-5 because CentOS-5 is built from publicly available, open source SRPMS. The documentation is unmodified to be compliant with upstream distribution policy. Neither CentOS-5 nor the CentOS Project are in any way affiliated with or sponsored by Red Hat®, Inc.