Hi,
Was hoping someone would be able to help me with a problem I'm having
with Castle Scheduler. I am using scheduler to run jobs 3 times a day
at specified time. For instance, at 4 am, 12 pm and 8 pm.
I do not want the job to run immediately after it is scheduled (ie.
persisted to the scheduler database). Instead, I want it to run only
at one of the specified times. So, for instance, if I create a new
job at 1 pm, I don't want it to run immediately, I want it to run
instead, for the first time, at 8 pm.
Is there a way to do this? Here's the code I have to schedule the job
(assume the scheduler is already configured):
var startDate = new DateTime(date.Year, 1, 1, 4, 0,
0).ToUniversalTime();
var period = new TimeSpan(0, 8, 0, 0);
var trigger = new PeriodicTrigger(startDate, null, period, null);
var jobSpec = new JobSpec(job.ID.ToString(), String.Empty, "MyJob",
trigger) { Name = "JobName" };
scheduler.CreateJob(jobSpec, CreateJobConflictAction.Replace);
Any ideas/help appreciated!
Thanks.
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.