AMCC 9500S User Manual

Page of 103
Working with 3ware CLI
www.3ware.com 
7
Using a single command with output
You can use 3ware CLI with line arguments, processing a single command at 
a time. To do so, simply enter the command and the arguments.
Single commands can be useful when you want to perform a task such as 
redirecting the output of the command to a file. It also allows you to use the 
command line history to eliminate some typing. 
Syntax
tw_cli 
<command_line_arguments>
Example 
tw_cli /c0 show diag > /tmp/3w_diag.out
Using an input file to execute a script
You can operate 3ware CLI scripts by executing a file. The file is a text file 
containing a list of CLI commands which you have entered in advance. Each 
command must be on a separate line.
Syntax
tw_cli -f <filename>
Where 
<filename>
 is the name of the text file you want to execute.
Example
tw_cli -f clicommand.txt
This example executes the file 
clicommand.txt
, and runs the CLI commands 
included in that file.
Scripting example
Following is a scripting example using a text file called config_unit.txt, 
containing three commands. This example sets up a 12-port controller with 
two units: one with the first 2 drives mirrored, and another with the remaining 
drives in a RAID 5 array. It then prints the configurations for verification. The 
commands included in the script file are:
/c0 add type=raid1 disk=0-1
/c0 add type=raid5 disk=2-11
/c0 show
To run the script, enter:
tw_cli -f config_unit.txt