3.5.6. Use the Management CLI in Batch Mode
Summary
Batch processing allows a number of 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.
Prerequisites
Procedure 3.12. Batch Mode Commands and Operations
Enter batch mode
Enter batch mode with thebatch
command.[standalone@localhost:9999 /] batch [standalone@localhost:9999 / #]
Batch mode is indicated by the hash symbol (#
) in the prompt.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.Refer to Section 3.5.8, “Use Operations and Commands in the Management CLI” for details on formatting operation requests.Run the batch
Once the entire sequence of operation requests is entered, run the batch with therun-batch
command.[standalone@localhost:9999 / #] run-batch The batch executed successfully.
Refer to Section 3.5.7, “CLI Batch Mode Commands” for a full list of commands available for working with batches.Batch commands stored in external files
Frequently run batch commands can be stored in an external text file and can either be loaded by passing the full path to the file as an argument to thebatch
command or executed directly by being an argument to therun-batch
command.You can create a batch command file using a text editor. Each command must be on a line by itself and the CLI should be able to access it.The following command will load amyscript.txt
file in the batch mode. All commands in this file will now be accessible to be edited or removed. New commands can be inserted. Changed made in this batch session do not persist to themyscript.txt
file.[standalone@localhost:9999 /] batch --file=myscript.txt
The following will instantly run the batch commands stored in the filemyscript.txt
[standalone@localhost:9999 /] run-batch --file=myscript.txt
Result
The entered sequence of operation requests is completed as a batch.