Daniel,
Did you ever get your CronTrigger issue resolved? Like I said, I'm
pretty new to Quartz myself, but I feel fairly certain that your
problems are coming from a combination of timezone and misfire
instruction configuration. Did you set the misfire instruction to
"DoNothing" on your CronTrigger? Regardless of other issues, if you
want to ignore "missed" fire times when you start the service, that
should be your setting.
Regarding the rest: as best as I can tell, CronTriggers are fairly
self-contained and, oddly enough, are timezone aware. If you're using
a database for your jobstore, look at the cron trigger table, and
you'll see that it has a timezone field! I haven't asked these guys,
but this must be one place where Quartz does use the local machine's
timezone automatically when creating objects, which is a little
confusing since everything else Quartz does is in GMT. However, before
I muddy the waters, let me just say: nof this should really matter. If
the CronExpression string is correct, forget about that part for now
and just trust it. The real issue has to do with your StartTimeUtc
field. What date are you using for that field? Is it coming from a GUI
by any chance? If so, you could be having the same problem I was,
which is that the GUI was already using universal time without any
awareness of timezone, so when I set StartTimeUtc =
myDate.ToUniversalTime, it caused a double-conversion, if you will,
and was totally screwing up the start time. So where is your
StartTimeUtc coming from? If you're simply creating a new DateTime on
a machine that is running in your timezone, make sure you do the
following:
DateTime myDateOnMyMachineWithTimezoneSetToEastern = new DateTime();
trigger.StartTimeUtc =
myDateOnMyMachineWithTimezoneSetToEastern.ToUniversalTime();
If you're using a GUI (or some other class) that sends you the start
date, you might want to check the "Kind" property on the DateTime
object and see what it is. What I finally realized was that my GUI had
a timezone-offset setting that did the conversion for me to universal
time! So, when I created the trigger, I didn't have to call
ToUniversalTime, because the GUI had already done it with the correct
timezone offset.
Does any of this make sense? Like I said, if your CronExpression
string is correct, and it appears to be, then don't worry about it,
just make sure the value you set for StartTimeUtc is correct. If you
have more trouble, let me know and I can try to send a small console
app?
Good luck,
Landon