此内容没有您所选择的语言版本。

Chapter 7. Batch Processing


Batch processing allows multiple operation requests to be grouped in a sequence and executed together as a unit. If any of the operation requests in the sequence fail, the entire group of operations is rolled back.

Note

Batch mode does not support conditional statements.

  1. Enter batch mode with the batch management CLI command.

    batch

    Batch mode is indicated by the hash symbol (#) in the prompt.

  2. Add operation requests to the batch.

    Once in batch mode, enter operation requests as normal. The operation requests are added to the batch in the order they are entered.

    You can edit and reorder batch commands. You can also store a batch for processing at a later time. See Batch Mode Commands for a full list of commands available for working with batches.

  3. Run the batch.

    Once the entire sequence of operation requests is entered, run the batch with the run-batch command.

    run-batch

    The entered sequence of operation requests is completed as a batch and prints the result to the terminal: The batch executed successfully.

Batch Commands in External Files

Frequently-run batch commands can be stored in an external text file and can be loaded either by passing the full path to the file as an argument to the batch command or executed directly by being passed as an argument to the run-batch command.

You can create a batch command file by using a text editor and placing each command on its own line.

The following command will load the myscript.txt file in batch mode. The commands from this file can then be edited or removed. New commands can be inserted. Changes made in this batch session do not persist to the myscript.txt file.

batch --file=myscript.txt

The following will immediately run the batch commands stored in the file myscript.txt

run-batch --file=myscript.txt

The entered sequence of operation requests is completed as a batch.

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.