DEFINE SCRIPT (Define an IBM Spectrum Protect script)
Use this command to define an IBM Spectrum Protect script or to create a new IBM Spectrum Protect script by using the contents from another script.
The first line for the script can be defined with this command. To add subsequent lines to the script, use the UPDATE SCRIPT command.
- 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 runs only on the server from which the RUN command is issued.
- You cannot redirect the output of a command within an IBM
Spectrum Protect 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
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 that 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 you proceed to the next command. Commands 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 are read into the script to be defined. The file
must reside on the server where this command is running. 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 displays 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 routes the QUERY STGPOOL command to a server group named DEV_GROUP.define script qu_stg "(dev_group) query stgpool"run qu_stgExample: 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. The file must be on the server, and be read by the server.define script agadm file=my.scriptRelated commands
| 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. |