Job - addIntervalScheduleWithEMailNotification
Job - addIntervalScheduleWithEMailNotification
Description :
This command adds an interval schedule to a job and, depending on the resulting status of the job run, issues an email notification.This command is not supported if the approval is enabled for the job type.
The argument jobKey is a handle to the job being modified. To find the jobKey for a specific job type, use the SnapshotJob getDBKeyByGroupAndName command.
The dateString argument defines a start time for the schedule to be added. It must be in the format YYYY-MM-DD HH:MM:SS.
The days, hours, and mins arguments let you specify the interval in days, in hours and in minutes.
The recipient argument identifies the receiver of the email that this command generates. The statusType argument indicates the statuses for which you want to issue a notification. The possible statuses have the following values:
- Success=2
- Failure=4
- Cancel=8
For statusType, add the statuses for which you want to issue notifications. For example, if you want to issue notifications when the job status is Failure or Cancel, then statusType=12.
Return type : java.lang.Object
Command Input :
Variable Name | Variable Type | Description |
---|---|---|
jobKey | com.bladelogic.om.infra.model.base.keys.SJobKey | Handle to the job. |
dateString | String | Start time of the schedule to be added. The date string must be in the format YYYY-MM-DD HH:MM:SS. |
days | Integer | Number of days in the interval. |
hours | Integer | Number of hours in the interval. |
mins | Integer | Number of minutes in the interval. |
recipient | String | Receiver of the email notification. |
statusType | Integer | Sum of all statuses for which you want to issue notifications. See above for a more complete description. |
Example
The following example shows how to add an interval schedule to a job, starting at 11:35 PM. Email will be sent on success, failure, or cancel.
Script
RECIPIENT="datacenteradmin@anundisclosedcompany.com"
NOTIFICATION_STATUS=14
DATE_STRING="2005-01-01 23:35:00"
DAYS="1"
HOURS="10"
MINS="12"
JOB_KEY=`blcli SnapshotJob getDBKeyByGroupAndName /snapshots snapconfig`
JOB_KEY=`blcli Job addIntervalScheduleWithEMailNotification $JOB_KEY "$DATE_STRING" "$DAYS" "$HOURS" "$MINS" $RECIPIENT $NOTIFICATION_STATUS`