Information
Unsupported content This version of the documentation is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments.

BatchJob - executeJobAndWaitWithApproval


BatchJob - executeJobAndWaitWithApproval

Description :

This command executes a Batch Job and waits for the job to end before returning.The execution of the job starts only after the approval is received.

Use this command to execute a job immediately after approval 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 also pauses the execution until the approval is received, so if it is used with Manual Approval, it will wait until the approval is received. This command returns a handle to the job run, which can be used in other commands that need to reference the Batch Job run.

Return type : com.bladelogic.om.infra.app.service.job.JobRunKey

Command Input :

Variable Name

Variable Type

Description

jobKey

DBKey

A handle to the Batch Job to be executed.

approvalId

Integer

Approval ID created using the Job namespace.

Example

The following example shows how to execute a Batch Job.

Script


# Name of the existing Batch Job.

BATCHJOB_NAME="batchjob1"

# Job group in which the Batch Job is stored.

BATCHJOB_GROUP="/parent/group1"

# Get the Batch Job DBKey using the above information.

BATCHJOB_DBKEY=`blcli BatchJob getDBKeyByGroupAndName $BATCHJOB_GROUP $BATCHJOB_NAME`

BATCHJOB_APPROVAL_ID=`blcli Job createApproval 2 2 "My change" 2 3 "" ""`

#Execute the Batch Job after approval

BATCHJOB_RUN_KEY=`blcli BatchJob executeJobAndWaitWithApproval $BATCHJOB_DBKEY $BATCHJOB_APPROVAL_ID`



 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

BMC Server Automation Command Line Interface 8.5