Table of Contents
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”.
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.
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.
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.
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".
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).
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.