Chapter 4. Calendars

Table of Contents

Overview
Mark periods for daily events
Mark periods for weekly events
Mark periods for monthly events
Mark days with specific dates
Mark days with CRON expressions
Time zone selection

Overview

Triggers may use calendars to determine special date or times that should be excluded from the firing schedule. Upon adding a Calendar you will see Figure 4.1, “Calendar Wizard”.

Figure 4.1. Calendar Wizard

Calendar Wizard

Mark periods for daily events

You can use this option to mark ranges of the day when the trigger should not fire. For example, if you want to avoid performing an hourly data loading operation between midnight and 6 am, you would set Start Time 12 am End Time 6 am to exclude that range.

Mark periods for weekly events

This option allows you to choose which days of the week to exclude. For example, you could select Saturday and Sunday to prevent associated triggers from firing at the weekend.

Mark periods for monthly events

This option allows you to choose which days of the month to exclude. For example, you could select all but 1 and 15 in order to have the trigger restricted to fire on only the first and fifteenth of each month.

Mark days with specific dates

To prevent triggers being fired on public holidays, you can identify them using this calendar option. You can also choose whether the dates apply only for one year (some holidays change date each year) or whether the same date should be excluded every year. For example, to exclude triggers from firing on Christmas Day you would set the Date to Dec 25th and tick "Repeat every year".

Mark days with CRON expressions

The CRON expression option is the most powerful, but requires the most configuration. Remember that the expressions chosen are used to exclude not include times from the firing of a trigger. In most cases a combination of the previous options will be easier to maintain. If a trigger is scheduled to fire every hour, e.g. 00:00:00, 01:00:00, 02:00:00 etc. then you can use a CRON expression

0 0 /2 ? 0,6 *

to restrict the trigger to fire only once every two hours on weekends. The CRON sample does this by excluding 00:00:00, 02:00:00, 04:00:00 etc. for days 0 and 6 (Sunday and Saturday).

Note

You can attach more than one trigger to a job, so an alternative strategy for regular restrictions such as this would be to define a one hourly trigger for weekdays and a second two-hourly trigger for weekends. This would avoid any exclusion ranges and would perhaps be more flexible to maintain.

Time zone selection

After marking periods or days, you will be guided to the Time Zone page. Select the correct time zone where you want the job to be fired, which will be used when interpreting this calendar.