HP StorageWorks Command View XP Command Line Interface (CLI) reference guide (B9357-96161, January 2006)

Command View XP Command Line Interface (CLI) reference guide 185
5 Batch processing
Use the Command View CLI to run one or more CLI commands contained in a text file called a batch file.
Batch processing features include:
Ability to invoke the CLI, execute commands in a batch file, and then terminate.
Ability to execute a batch file during an interactive CLI session by using the execute command.
Ability to direct output from batch operations to a file.
Faster execution by processing related configuration change commands simultaneously.
Batch file setup
Use a word processor or text editor to set up the batch file. Insert one or more CLI commands into the file
using normal command syntax.
You can insert comments by starting the comment line with the “#” character. Use the “/” character to
continue a command to another line.
A simple batch file example is shown below:
# This is a comment line
connect 10043
list lun
list ldev
list wwn
# Next command is create lun
# Syntax is create lun Port_name,
# SCSID, LUN, CU, Ldev
create lun CL1-A, 2, 3, 0, 4
create lun CL1-B, 3, 4, 1, /
5
Commands in a batch file are not executed in the order they are listed in the file. Instead, similar
commands are grouped together and executed together to increase speed and efficiency. See ”Multiple
set operations” on page 192.
CLI output and error messages (data and syntax validation, execution errors) are sent to stdout, typically
your screen. If the CLI client program fails, the resulting error output will go the stderr file, typically the
screen.
NOTE: Only CLI commands can be used in a batch file. Other shell commands or DOS commands are
not allowed.
Batch processing with the -f option
Use the -f option to declare which batch file the CLI should run. This option starts the CLI and it processes
the commands in the file you specify. For example:
cvcli -f listlun.txt
One connect command is mandatory in the file to specify which different operations are to be carried
out. You can manage only one disk array in each script or file. Also, you cannot include commands that
execute an operation on the same resource. For example, you cannot create and delete the same LUN in a
single file.
Use only one batch file at a time. The filename can contain a relative or absolute path. A relative path will
be relative to the directory where the CLI was started.
The CLI will automatically disconnect from any disk array before terminating.
For more information about batch processing with the -f option, see the following instructions and script
files. These files are located in the cvcli.tar file, which is the CLI client file available on the Command
View Support tab.