What is the easiest way to build trigger for a job with given interval as TimeSpan and specified DayOfWeek in 2.1.x versions?
Asked
Active
Viewed 218 times
2 Answers
2
Why do you want to build a simple Trigger ? Simple Triggers are prone to DST issues. Make a CRON Trigger using a CRON expression and specify an end time so that the job expires.

Geek
- 23,089
- 20
- 71
- 85
-
yes, I used to make triggers using crone expressions, but situation above (just set dayOfWeek and interval in TimeSpan type) sounds like quite easy, and i suppouse there is better way to build such trigger than to parse TimeSpan for seconds, minutes and hours, and generate cron expression. Not necessary it should be simple trigger. – Bogdan Dudnik Apr 29 '13 at 10:41
-
Yes, it is easy to set Start time in SimpleTrigger and then set repeat Interval as 7*24*60*60, this will do the trick. However you will run into issues when DST becomes active/deactive. – Geek Apr 29 '13 at 11:41
1
Geek is very right, cron expression may be a bit tricky at first look but they are flawless.
As for quartz, cron expression for "Day of week" can be like: 0 0 8 ? * 1 *
Would mean 8 AM every Monday
You better refer to: Quartz CronTrigger

Kartikya
- 455
- 2
- 9