ExecutionTask - addWeeklySchedule
ExecutionTask - addWeeklySchedule
Description :
This command adds a weekly schedule to an execution task.
The argument etKey is a handle to the execution task being modified. To find the etKey for an execution task, use the ExecutionTask getDBKeyByGroupAndName command.
The dateString argument defines a weekly schedule to be added to the execution task definition. It must be in the format YYYY-MM-DD HH:MM:SS. Use the daysOfWeek argument to specify a sum representing the days when the execution task should execute. Each day of the week has a value, as shown below:
- SUNDAY=1
- MONDAY=2
- TUESDAY=4
- WEDNESDAY=8
- THURSDAY=16
- FRIDAY=32
- SATURDAY=64
Add values representing the days when you want the execution task to run. For example, if you want the job to run on Monday, Wednesday, and Friday, then daysOfWeek=42. Use the frequency argument to specify an interval in weeks for the job to run (for example, 2 means the execution task runs every other week).
This command does not send execution task notification. This command returns the id of the created schedule.
Return type : Integer
Command Input :
Variable Name | Variable Type | Description |
|---|---|---|
etKey | com.bladelogic.om.infra.model.base.keys.SExecutionTaskKey | Handle to the execution task. |
dateString | String | Weekly schedule to be added. The date string must be in the format YYYY-MM-DD HH:MM:SS. |
daysOfWeek | Integer | Days of the week when the job should execute. See above for a more detailed description. |
frequency | Integer | Interval in weeks when the job should run. |
Example
The following example shows how to add a weekly job run to an execution task. In the example, the execution task runs every three weeks at 11:35 PM on Monday, Wednesday, and Friday.
Script
DATE_STRING="2005-01-01 23:35:00"
DAYS_OF_WEEK=42
FREQUENCY=3
ET_KEY=`blcli ExecutionTask getDBKeyByGroupAndName /tasks tstEt`
ET_KEY=`blcli ExecutionTask addWeeklySchedule $ET_KEY "$DATE_STRING" $DAYS_OF_WEEK $FREQUENCY`