3Ware 9650SE-2LPB-10 CLI Guide - Page 14

Using a single command with output, Using an input file to execute a script, Scripting examples

Page 14 highlights

Chapter 1. Introduction to the 3ware Command Line Interface 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 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 Where 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 examples Following is a scripting example for a 4-port controller using a text file called config_unit.txt, containing three commands. This example sets up a 4-port controller with two units, each with 2 drives mirrored. 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=raid1 disk=2-3 /c0 show Following is a scripting example for a 12-port controller using a text file called config_unit.txt, containing three commands. This example sets up a 12port controller with two units: one with the first 2 drives mirrored, and another 8 3ware Serial ATA RAID Controller CLI Guide

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103

Chapter 1. Introduction to the 3ware Command Line Interface
8
3ware Serial ATA RAID Controller CLI Guide
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 examples
Following is a scripting example for a 4-port controller using a text file called
config_unit.txt, containing three commands. This example sets up a 4-port
controller with two units, each with 2 drives mirrored. 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=raid1 disk=2-3
/c0 show
Following is a scripting example for a 12-port controller 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