NSHScriptJob - executeJobAndWaitWithApproval
NSHScriptJob - executeJobAndWaitWithApproval
Description :
This command executes an NSH Script Job after approval is received and waits for the job to end before returning.
Use this command to execute a job after approval is received unless the job should be scheduled. Because this command does not return until the job completes, it effectively pauses execution of any script running this command. This command returns a handle to the job run, which can be used in other commands that need to reference an NSH Script Job run.
Return type : com.bladelogic.om.infra.app.service.job.JobRunKey
Command Input :
Variable Name | Variable Type | Description |
|---|---|---|
jobKey | DBKey | Handle to the NSH Script Job to be executed. |
approvalId | Integer | Approval ID created using the Job namespace. |
Example
The following example gets a handle to an NSH Script Job, executes the job, and waits for the job to end before returning.
Script
JOB_FOLDER="/Jobs/NSHScriptJobs"
JOB_NAME="Run on all Servers"
JOB_KEY=`blcli NSHScriptJob getDBKeyByGroupAndName "$JOB_FOLDER" "$JOB_NAME"`
JOB_APPROVAL_ID=`blcli Job createApproval 2 2 "My change" 2 3 "" ""`
JOB_RUN_KEY=`blcli NSHScriptJob executeJobAndWaitWithApproval $JOB_KEY $JOB_APPROVAL_ID`
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*