Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
218 views
in Technique[技术] by (71.8m points)

Quartz Cron Expression: Run Job Every 1 hr 10 minutes 20 seconds starting NOW (immediately)

I want to run a job every 1 hr 10 minutes and 20 seconds.

For this i have tried with the following cron expression.

"0/4220 * * * * ?"

But I cannot set more than 60 seconds. what will be the cron expression for the above need?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Instead of Quartz cron, we can use the simple trigger for this scenario.

In simple trigger we can use based on our need like the following.

We can convert the whole thing as seconds and we can repeat it.

For the 15 minutes and 10 seconds, I have used like the following. Even we can convert in minutes itself.

 ITrigger trigger = TriggerBuilder.Create()
.WithIdentity("trigger3", "group1")
.WithSimpleSchedule(x => x
    .WithIntervalInSeconds(910)
    .RepeatForever()) // note that 10 repeats will give a total of 11 firings
.ForJob(job) // identify job with handle to its JobDetail itself                   
.Build(); 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...