Administrator's Reference

DEFINE SCRIPT (Define a Tivoli Storage Manager Script)

Use this command to define a TSM script or to create a new TSM 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.

Note:When routing commands inside scripts, enclose the server or server group in parentheses and omit the colon. 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.

Privilege Class

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

Syntax

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

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.

Examples

Task 1

Define a script that will display all AIX clients.

Command:
define script qaixc "select node_name from nodes where platform='AIX'" desc='Display aix clients'

Task 2

Define and run a script that will route the QUERY STGPOOL command to a server group named DEV_GROUP.

  1. Define a script called QU_STG and route it to the DEV_GROUP server group:

    Command:
    (dev_group) define script qu_stg "query stgpool"

  2. Run the script:

    Command:
    run qu_stg

Task 3

Define a script whose command lines are read in from a file that is named MY.SCRIPT. Name the new script AGADM.

Command:
define script agadm file=my.script

Related Commands

Table 75. 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.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]