IBM Tivoli Storage Manager, Version 7.1

DEFINE SCRIPT (Define a Tivoli Storage Manager script)

Use this command to define a Tivoli® Storage Manager script or to create a new Tivoli Storage Manager script using the contents from another script.

The first line for the script may be defined with this command. To add subsequent lines to the script, use the UPDATE SCRIPT command.

Tips:
  • When routing commands inside scripts, enclose the server or server group in parentheses and omit the colon. Otherwise, if the syntax includes a colon, the command is not routed when the RUN command is issued. Instead, the command will only run on the server from which the RUN command is issued.
  • You cannot redirect the output of a command within a Tivoli Storage Manager script. Instead, run the script and then specify command redirection. For example, to direct the output of script1 to the c:\temp\test.out directory, run the script and specify command redirection as in the following example:
    run script1 > c:\temp\test.out

Privilege class

To issue this command, you must have operator, policy, storage, or system privilege.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-DEFine SCRipt--script_name----------------------------------->

                   .-Line--=--001----.     
>--+-command_line--+-----------------+-+------------------------>
   |               '-Line -=--number-' |   
   '-File--=--file_name----------------'   

>--+-----------------------------+-----------------------------><
   '-DESCription--=--description-'   

Parameters

script_name (Required)
Specifies the name of the script to be defined. You can specify up to 30 characters for the name.
command_line
Specifies the first command to be processed in a script. You must specify either this parameter (and, optionally, the LINE parameter) or the FILE parameter.

The command you specify can include substitution variables and can be continued across multiple lines if you specify a continuation character (-) as the last character in the command. Substitution variables are specified with a '$' character, followed by a number that indicates the value of the parameter when the script is processed. You can specify up to 1200 characters for the command line. Enclose the command in quotation marks if it contains blanks.

You can run commands serially, in parallel, or serially and in parallel by specifying the SERIAL or PARALLEL script commands for the COMMAND_LINE parameter. You can run multiple commands in parallel and wait for them to complete before proceeding to the next command. Commands will run serially until the parallel command is encountered.

Conditional logic flow statements can be used. These statements include IF, EXIT, and GOTO.

Line
Specifies the line number for the command line. Because commands are specified in multiple lines, line numbers are used to determine the order for processing when the script is run. The first line, or line 001 is the default. This parameter is optional.
File
Specifies the name of the file whose contents will be read into the script to be defined. The file must reside on the server running this command. If you specify the FILE parameter, you cannot specify a command line or line number.

You can create a script by querying another script and specifying the FORMAT=RAW and OUTPUTFILE parameters. The output from querying the script is directed to a file you specify with the OUTPUTFILE parameter. To create the new script, the contents of the script to be defined are read in from the file you specified with the OUTPUTFILE parameter.

DESCription
Specifies a description for the script. You can specify up to 255 characters for the description. Enclose the description in quotation marks if it contains blank characters. This parameter is optional.

Example: Write a script to display AIX clients

Define a script that will display all AIX® clients.
define script qaixc "select node_name from nodes where platform_name='AIX'"
  desc='Display aix clients'

Example: Write and run a script to route a command to a server group

Define and run a script that will route the QUERY STGPOOL command to a server group named DEV_GROUP.
define script qu_stg "(dev_group) query stgpool"
run qu_stg

Example: Create a script from an existing script

Define a script whose command lines are read in from a file that is named MY.SCRIPT and name the new script AGADM.
define script agadm file=my.script

Related commands

Table 1. Commands related to DEFINE SCRIPT
Command Description
COPY SCRIPT Creates a copy of a script.
DELETE SCRIPT Deletes the script or individual lines from the script.
QUERY SCRIPT Displays information about scripts.
RENAME SCRIPT Renames a script to a new name.
RUN Runs a script.
UPDATE SCRIPT Changes or adds lines to a script.


Feedback