2014-09-29 3 views
0

Quartz.Net을 매일 주어진 시간에 평일의 숫자로 실행하도록 예약하려고합니다. 일정은 영원히 계속되어야합니다. 예를 들어주어진 시간에 Quartz.Net 트리거

: 12:00

@ 12시

  • 토요일 @ 12시
  • 목요일 @

    • 월요일 나는 다음과 같은 구성을 가지고 있지만 그렇지 않습니다 명예의 시간, 그것이 생성 된 모든 시간은 00:00이지만 정확한 날짜에 있습니다.

      DateTimeOffset off = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, 12, 0, 0, DateTimeKind.Utc); 
      
      var trigger = TriggerBuilder.Create(). 
          WithIdentity("Test"). 
          WithDailyTimeIntervalSchedule(x => 
           x.InTimeZone(TimeZoneInfo.Utc). 
           WithIntervalInHours(24). 
           OnDaysOfTheWeek(process.RunAtDays)). 
          StartAt(off). 
          Build(); 
      

      이의 출력은 보이는 같은

      • 2014년 1월 10일
      • 2014년 8월 10일 0시
      • 15/10/2014 @ 0시 @ 00:00

      나는 지금까지 행운과 함께 작동하도록 다양한 조합을 시도했다.

      나는 동등한 크론 구성이 될 것이라고 믿습니다

      "0 00 12 ? * MON,THU,SAT" 
      

      하지만 최종 사용자가 구성 할 수있는 값이 필요합니다.

  • 답변

    1

    가치가있는 좋은 몇 시간을 보낸 후에 나는 작업을 완료하는 데 올바른 조합이 있다고 생각합니다. StartingDailyAt()을 반복 할 시간으로 설정해야했습니다. 완성 된 코드는 다음과 같습니다.

    DateTimeOffset off = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, 12, 0, 0, DateTimeKind.Utc); 
    
    var trigger = TriggerBuilder.Create(). 
        WithIdentity("Test"). 
        WithDailyTimeIntervalSchedule(x => 
         x.InTimeZone(TimeZoneInfo.Utc). 
         WithIntervalInHours(24). 
         OnDaysOfTheWeek(process.RunAtDays). 
         StartingDailyAt(TimeOfDay.HourMinuteAndSecondOfDay(12, 0, 0))). 
        StartAt(off). 
        Build(); 
    
    관련 문제