Reputation: 6962
I want to create cron expression for a my job, but I don't know, how I can excluded specific day of week from expression.
triggerBuilder
.ForJob(jobKey)
.WithSchedule(CronScheduleBuilder.CronSchedule("????")).InTimeZone(TimeZoneInfo.Utc))
.StartNow()
.WithIdentity(triggerKey)
.Build();
For example: I want to fire my job every day except Monday.
I found approach where we can set firing of job at noon (12 PM) every day from interval:
0 0 0 ? * MON-FRI
or 0 0 0 ? * 1-5
but what about excepting specific day from this interval, for example "Thursday".
Thanks for a help :)
Upvotes: 3
Views: 8715
Reputation: 7737
Using cronmaker.com, an example Cron schedule that executes every day except Monday at 12pm would be:
0 0 12 ? * TUE,WED,THU,FRI,SAT,SUN *
Obviously the site will let you tailor this as required, but hopefully if the site ever goes down, and someone has a similar example, they will be able to use this expression as a guide to creating their own.
Upvotes: 5