Question

I am using cron expressions for my application. I want to build a cron expression to run at every 40 seconds starting from now.

For example; If my job starts at 3.05 then job should be fired at 3.45,4.25,5.05 etc..how to write cron expression for this case.

Can anyone help me?

Was it helpful?

Solution

You can use a CronTrigger if you're interested in calendar-based schedulers (for example every 40 seconds Monday to Friday, or every Tuesday etc) or a SimpleTrigger if you just want it to fire every 40 seconds ad infinitum.

There are plenty of examples here: http://quartznet.sourceforge.net/tutorial/lesson_5.html

This trigger may help you but have a look through the rest of the examples (plenty of them on the web!):

ITrigger trigger = TriggerBuilder.Create()
.WithIdentity("trigger1", "group1")
.WithDailyTimeIntervalSchedule(x => x.OnMondayThroughFriday().WithIntervalInSeconds(40))
.Build();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top