IBM DS8000 manual Interactive mode, Script mode, Example 11-3 Creating a DS CLI script

Models: DS8000

1 450
Download 450 pages 61.48 Kb
Page 262
Image 262

csadmin op_copy_services exit status of dscli = 0

C:\Program Files\IBM\dscli>

It is also possible to include single commands in a script, though this is different from the script mode described later. This is because every command that uses the DS CLI would invoke the DS CLI and then exit it. A simple Windows script is shown in Example 11-2.

Example 11-2 A script to list all users and place their names in a file

@ECHO OFF

rem This script is used to list all DS CLI users

rem The lsuser command is executed and the output is sent to file called userlist.txt

dscli lsuser > userlist.txt

echo The user list has been created and placed in userlist.txt

For those readers familiar with UNIX, a simple example of creating a script is shown in Example 11-3.

Example 11-3 Creating a DS CLI script

/opt/ibm/dscli >echo “dscli lsuser > userlist.txt” > listusers.sh /opt/ibm/dscli >chmod +x listusers.sh

/opt/ibm/dscli >./listusers.sh /opt/ibm/dscli >cat userlist.txt

Name Group

=========================

admin admin

/opt/ibm/dscli>

Interactive mode

In the interactive mode, the user starts the DS CLI program within a shell, and then issues DS CLI commands until the DS CLI is no longer needed. At this point the user exits the DS CLI program. To avoid having to enter authentication details, a profile and password file would have to be created first. The use of the interactive mode is shown in Example 11-4.

Example 11-4 Using DS CLI in interactive mode

C:\Program Files\IBM\dscli>dscli dscli> lsuser

Name Group

=========================

admin admin

csadmin op_copy_services dscli> exit

exit status of dscli = 0

C:\Program Files\IBM\dscli>

Script mode

The script mode allows a user to create a DS CLI script that contains multiple DS CLI commands. These commands are performed one after the other. When the DS CLI executes the last command, it ends and presents a return code. DS CLI scripts in this mode must

240DS8000 Series: Concepts and Architecture

Page 262
Image 262
IBM DS8000 manual Interactive mode, Script mode, Example 11-3 Creating a DS CLI script