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.

Job - addMonthlyScheduleWithEMailNotificationAndPriority_1


Job - addMonthlyScheduleWithEMailNotificationAndPriority

Description :

This command adds a monthly schedule with specified priority to a job with support for all schedule choices (specific day of a particular week of every month, particular day of every month or last day of every month) and, depending on the resulting status of the job run, issues an email notification. Monthly schedule with email notification is not supported if 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.

There are three types of monthly schedules that are supported. The command requires specifying one of the types listed below to add appropriate schedule to the job.

  • Specific day of every month=0
  • Specific day of a week of every month=1
  • Last day of every month=2

The dateString argument defines a monthly schedule to be added to the job definition. It must be in the format YYYY-MM-DD HH:MM:SS.

Use the dayOfWeekOrMonth argument to specify the day when the job executes. For last day of month schedule (scheduleType=2) this argument gets ignored and you may specify -1 as its value. For specific day of month schedule (scheduleType=0), this specifies actual calendar day (1-31) and for specific day of a week schedule (scheduleType=1) it provides the actual day of the week based on the following scheme.

  • SUNDAY=1
  • MONDAY=2
  • TUESDAY=4
  • WEDNESDAY=8
  • THURSDAY=16
  • FRIDAY=32
  • SATURDAY=64

Use the weekOfMonth argument for specific day of a week schedule (scheduleType=1), to select the week in which the job will execute. Set value to -1 to execute the job in last week of every month. Please note any value entered gets ignored for all other type of schedules (scheduleType=0 or scheduleType=2).

The recipient argument identifies the receiver of the email that this command generates. The statusType argument determines the statuses for which you want to issue a notification. The possible statuses each have a value as follows:

  • 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.

Set priorityString to one of the following priorities:

  • CRITICAL
  • HIGH
  • NORMAL
  • LOW
  • LOWEST

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.

scheduleType

Integer

Type of monthly schedule. Valid types are listed above.

dateString

String

Monthly schedule to be added. The date string must be in the format YYYY-MM-DD HH:MM:SS.

dayOfWeekOrMonth

Integer

Day of the week or month to execute the job depending on the type of schedule. Refer command description for more details as values differ based on the type.

weekOfMonth

Integer

Specific week of the month to execute the job. Only applicable for day of week schedule and any provided value will be ignored for other types.

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.

priorityString

String

Priority of monthly schedule to be added.

Example

The following example shows how to add a monthly run with high priority to a job. The job runs at 11:35 PM on the second Tuesday of every month. Email will be sent on success, failure, or cancel.

Script





RECIPIENT="datacenteradmin@anundisclosedcompany.com"

NOTIFICATION_STATUS=14

SCHEDULE_TYPE=1

DATE_STRING="2005-01-01 23:35:00"

DAY_OF_WEEK=4

WEEK_OF_MONTH=2

PRIORITY_STRING=HIGH

JOB_KEY=`blcli SnapshotJob getDBKeyByGroupAndName /snapshots snapconfig`

JOB_KEY=`blcli Job addMonthlyScheduleWithEMailNotificationAndPriority $JOB_KEY $SCHEDULE_TYPE "$DATE_STRING" $DAY_OF_WEEK $WEEK_OF_MONTH $RECIPIENT $NOTIFICATION_STATUS $PRIORITY_STRING`



 

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

BMC Server Automation Command Line Interface 8.5