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 10-2.

Example 10-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

If you are familiar with UNIX, then a simple example of creating a script is shown in Example 10-3.

Example 10-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 or a password file would have to be created first. The use of the interactive mode is shown in Example 10-4.

Example 10-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 contain only DS CLI commands. This is because all commands in the script are executed by

204DS6000 Series: Concepts and Architecture

Page 228
Image 228
IBM DS6000 Series manual Interactive mode, Script mode, Example 10-3 Creating a DS CLI script