Parameterizing NSH scripts
You can parameterize the NSH scripts for use with service blueprint parameters.
For BMC Server Automation documentation related to this topic, see:
To parameterize NSH scripts
- Log on to BMC Server Automation.
- Click Depot.
You can start in the Depot with any script in the CSM_Scripts folder (for example, set_apache_admin_password.nsh). - Click the Parameters tab.
- Add script parameters (for example,
SERVER
andWEB_ADMIN_PASSWORD
).
In BMC Server Automation scripting, you pass parameters to a script based on the order they were input.SERVER
andWEB_ADMIN_PASSWORD
are passed as$1
and$2
. - Click the Script tab.
Parameterize the NSH script:
#!/bin/nsh SERVER=$1 PASSWORD=$2 RESULT='nexec $SERVER /c/Program\ Files/Apache\ Software\ Foundation/Apache2.2/bin/htpasswd -b "C:\Program Files\Apache Software Foundation\Apache2.2\password\htpasswd" admin $PASSWORD' EXIT_CODE=$? echo $EXIT_CODE
To make the script more readable, pass the parameters to your script by using an alias.
For example, assign the following aliases:
SERVER=$1
PASSWORD=$2
When the script is run, theSERVER
andPASSWORD
parameters will automatically replace$1
and$2
, making the script more readable.
The parameterized NSH script is now available for cloud administrators to use inside service blueprints.- Make sure that the cloud administrator knows the exact name of the NSH script (for example, set_apache_admin_password.nsh).
Where to go from here
For more information:
- Creating, copying, or editing a service blueprint on adding NSH scripts to service blueprints
- Configuring service blueprint parameters, especially To configure parameters
Comments
Log in or register to comment.