Job - addMonthlyScheduleWithPriority_1
Job - addMonthlyScheduleWithPriority
Description :
This command adds a monthly schedule 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 with specified priority to a job. This command 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).
This command does not send a job notification. To add a schedule that includes notifications, see the Job addMonthlyScheduleWithSNMPNotificationAndPriority or Job addMonthlyScheduleWithEMailNotificationAndPriority commands.
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. |
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 second Tuesday every month.
Script
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 addMonthlyScheduleWithPriority $JOB_KEY $SCHEDULE_TYPE "$DATE_STRING" $DAY_OF_WEEK $WEEK_OF_MONTH $PRIORITY_STRING`