NSHScript - addNSHScriptToDepotByGroupName
NSHScript - addNSHScriptToDepotByGroupName
Description :
This command adds an NSH script to the Depot.
This command returns the handle of the NSHscript object.
The groupName argument provides the fully qualified path to the depot group containing the script (for example, /nshscripts/systemscripts). The fileType argument is the fully qualified NSH-style path to the script that is being added (for example, //scripthost/path/to/script.nsh).
The scriptType argument specifies the run method for the NSH script. You can enter any of the following values:
- 1 - execute once passing a host list as a parameter
- 2 - execute on each host (runscript)
- 3 - execute using Perl interpreter
- 4 - copy and nexec
Return type : DBKey
Command Input :
Variable Name | Variable Type | Description |
---|---|---|
groupName | String | Full path to the depot group containing the NSH script. |
scriptType | Integer | Value representing the run method for the NSH script. See above for a more complete description. |
fileLocation | String | Full NSH-style path to the script being added to the Depot. |
name | String | Display name of the NSH script. |
description | String | Description of the NSH script. |
Example
The following example shows how to add a runscript type NSH script (that is, scriptType=2) to the Depot. The script includes a parameter that is editable and cannot be empty at run time.
Script
#constants
RUNONCE=1
RUNSCRIPT=2
RUNPERL=3
CPANDNEXEC=4
NSHSCRIPT_GROUP=/nshscripts
SCRIPTPATH=//scripthost/c/tmp/reboot.nsh
NSHSCRIPT=reboot
DESCRIPTION="reboot utility"
SCRIPT_TYPE=$RUNSCRIPT
SCRIPT_KEY=`blcli NSHScript addNSHScriptToDepotByGroupName $NSHSCRIPT_GROUP $SCRIPT_TYPE $SCRIPTPATH $NSHSCRIPT "$DESCRIPTION"`
#add timedelay
PARAM_NAME=timedelay
PARAM_DESC="seconds to reboot"
PARAM_VALUE=60
PARAM_FLAG=7 # must exist, takes a value and is editable.
SCRIPT_KEY=`blcli NSHScript addNSHScriptParameterByGroupAndName $NSHSCRIPT_GROUP $NSHSCRIPT "$PARAM_NAME" "$PARAM_DESC" $PARAM_VALUE $PARAM_FLAG`
Comments