Hi Michael, To create a trigger that runs exactly at a certain local time use:
// Create a trigger to fire at 4am local time each day. Trigger trigger1 = PeriodicTrigger.CreateDailyTrigger(DateTime.Now.Date.ToUniversalTime().AddHours(4)); // Create a trigger to fire at 12pm local time each day. Trigger trigger2 = PeriodicTrigger.CreateDailyTrigger(DateTime.Now.Date.ToUniversalTime().AddHours(12)); // Create a trigger to fire at 8pm local time each day. Trigger trigger3 = PeriodicTrigger.CreateDailyTrigger(DateTime.Now.Date.ToUniversalTime().AddHours(20)); You can have a look here http://using.castleproject.org/display/Comp/Castle.Components.Scheduler for more examples. Hope this helps John ________________________________ From: Michael <[email protected]> To: Castle Project Users <[email protected]> Sent: Tue, 22 June, 2010 4:48:49 AM Subject: Castle Scheduler help 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. -- 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.
