SnapshotJob - createTemplateBasedSnapshotJob
SnapshotJob - createTemplateBasedSnapshotJob
Description :
This command creates a Snapshot Job based on a template.
This command returns a handle to the newly created Snapshot Job. The DBKey can be used in other commands that need to reference the Snapshot Job you have created.
You must provide an ID for the job group that will contain this Snapshot Job. You can find this using JobGroup groupNameToId.
The templateKey argument provides a DBKey identifying the template that describes the assets on which the snapshot is based.
The serverName argument identifies the target of the snapshot. You can add target servers or target groups to the Snapshot Job using Job addTargetServer or Job addTargetGroup.
Return type : DBKey
Command Input :
Variable Name | Variable Type | Description |
|---|---|---|
jobName | String | Name of the job to be created. |
groupId | Integer | ID of the parent job group for the Snapshot Job. |
templateKey | DBKey | Handle to the template describing the assets to be included in the Snapshot Job. |
serverName | String | Target server for the Snapshot Job. |
Example
The following example creates a template-based Snapshot Job.
For this example, a component template must already exist, and a component must have already been discovered on the target server.
Script
JOB_GROUP_ID=`blcli JobGroup groupNameToId /Snapshots`
INDEX="Index" //Index means if template has only 1 component
TEMPLATE_KEY=`blcli Template getDBKeyByGroupAndName /filesystem basefiles`
COMPONENT_KEY=`blcli Component getComponentKeyByTemplateKeyAndServerId $TEMPLATE_KEY $SERVER_ID $INDEX`
JOB_KEY=`blcli SnapshotJob createTemplateBasedSnapshotJob basefilesnap $JOB_GROUP_ID $TEMPLATE_KEY $TARGETSERVER`