BatchJob - executeJobAndWait
BatchJob - executeJobAndWait
Description :
This command executes a Batch Job and waits for the job to end before returning. If approval is enabled for the job type use the other command which takes in approval id as an additional input.
Use this command to execute a job 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 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. |
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`
#Execute the Batch Job
BATCHJOB_RUN_KEY=`blcli BatchJob executeJobAndWait $BATCHJOB_DBKEY`
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*