• I need to build a cron expression to run a job every 10 minutes after the user click on start button.I'm trying to do something like:0 42/10 * * * ? *And 42/10 is like the user click to start at hh:42...


I need to build a cron expression to run a job every 10 minutes after the user click on start button.
I'm trying to do something like:
0 42/10 * * * ? *
And 42/10 is like the user click to start at hh:42 (example: 18h42). The next schedule is like:
1. Friday, March 20, 2015 6:42 PM
2. Friday, March 20, 2015 6:52 PM
3. Friday, March 20, 2015 7:42 PM
4. Friday, March 20, 2015 7:52 PM
5. Friday, March 20, 2015 8:42 PM
The problem is after second execution, the job waits like a hour to perform the next execution. How can i build a cron expression that starts immediately and after still running after N minutes?
解决方案
I think your format is wrong. The order of the fields is:
Minute
Hour
Day of Month
Month
Day of Week
Command
So in your example, the Minute is 0, and your Hour is invalid (Hour must be in the range 0-23). I'm guessing cron is ignoring the incorrect Hour, and running on Minute 0 of every hour.
However, if you did want to run every N minutes, you could use a format like (where N is less than 60):
0/N * * * * /bin/echo "Your Command Here"
However, keep in mind that the /N repeats the command every N minutes within the current hour. So, if you have 0/33 in your crontab your command will run at:
00:00
00:33
01:00
01:33
Not at:
00:00
00:33
01:06
01:39

展开全文
• 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 expressi...


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?
解决方案
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();

展开全文
•  2019-06-21 09:00:00 2019-06-21 09:30:00 2019-06-21 10:00:00 2019-06-21 10:30:00 2019-06-21 11:00:00 Cron表达式验证（ Cron表达式验证网址），图示如下： 到此 Cron表达式每半个小时执行一次介绍完成。

0 0/30 * * * ?

2019-06-21 09:00:00 2019-06-21 09:30:00 2019-06-21 10:00:00 2019-06-21 10:30:00 2019-06-21 11:00:00

Cron表达式验证（ Cron表达式验证网址），图示如下：

到此 Cron表达式每半个小时执行一次介绍完成。
展开全文
• I want a cron expression which fires every 45 minutes.According to the documentation, I have created this 0 0/45 * * * ? expression.But it is fired in a pattern like 12:00, 12:45, 13:00, 13:45, 14:00....


I want a cron expression which fires every 45 minutes.
According to the documentation, I have created this 0 0/45 * * * ? expression.
But it is fired in a pattern like 12:00, 12:45, 13:00, 13:45, 14:00.
But what I expect and want is to be fired at 12:00, 12:45, 13:30, 14:15.
What am I missing?
解决方案
Cron is not meant to solve such problems. It defines the exact date and times, when a trigger must be fired, not intervals. Use a simple schedule instead:
TriggerBuilder.Create()
.StartAt(startDate)
.WithSimpleSchedule(
simpleScheduleBuilder => simpleScheduleBuilder.WithIntervalInMinutes(45))
.Build();
Edit:
It's either a simple schedule as above, or multiple cron triggers (Quartz jobs can have multiple triggers):
0 0/45 12/3 * * ? # 12:00, 12:45, 15:00, 15:45, ...
0 30 13/3 * * ? # 13:30, 16:30, ...
0 15 14/3 * * ? # 14:15, 17:15, ...

展开全文
• 是这样写吗？ 0/1 * * * *? 急用。
• cron表达式1小时30分钟执行一次

万次阅读 热门讨论 2018-01-05 15:42:51
cron表达式: 0 30 0/1 * * ? 服了百度的不靠谱搜索，自己本来想懒省事，结果还是靠自己。 谢谢c友指正 。
• 常用表达式例子    0/2 * * * * ?表示2秒 执行任务 0 0/2 * * * ?表示2分钟 执行任务 ... 表示2小时 执行任务... 6L 2002-2006 表示2002-2006年的个月的最后个星期五上午10:15执行作 0 0 10,14,16 * *...
• 先了解个位置代表的含义，在了解个位置允许的范围，以及一些特殊写法，还有常用的案例，足够你掌握cron表达式
• 然后隔天去看日志，发现，从10点0分0秒开始，秒执行一次， 执行了3600次。然后才发现cron表达式配置错了，应该是 0 0 10 * * ？，这才是每天上午10点执行一次。幸亏是没有数据可以发短息，不然我要跑路了。 切记...
• 注:不涉及日历(不指定某月\天(周几)等),使用:Simple Trigger(测试代码粘贴在最后) ...隔90分钟执行一次 90*2= 180 = 3个小时 需要添加2个cron,间隔3小时 表达式: cron1 0 30 1/3 * * ? (1.30,4.30,7.30,,,,) c...
• Cron表达式详细解读

万次阅读 2020-12-14 14:12:45
Cron表达式个字符串，字符串以5或6个空格隔开，分为6或7个域，每一个域代表个含义，Cron有如下两种语法格式： 秒 分钟 小时 月份的第几天 月份 周的第几天 年份 1 Seconds ...
• cron表达式格式：{秒数} {分钟} {小时} {日期} {月份} {星期} {年份(可为空)}例 "0 0 12 ? * WED" 在星期三下午12:00 执行（年份通常 省略）先了解个位置代表的含义，在了解个位置允许的范围，以及一些特殊...
• cron表达式

2020-07-10 10:31:15
Cron表达式个字符串，字符串以5或6个空格隔开，分为6或7个域，每一个字段代表个含义，Cron有如下两种语法格式： 格式1 Seconds Minutes Hours DayofMonth Month DayofWeek Year 格式2 Seconds Minutes ...
• Cron表达式

2019-09-08 08:06:31
Cron表达式简介简介Cron的语法格式Cron表达式个时间元素的说明Cron格式中特殊字符的说明 简介 Cron表达式个字符串，包括6~7个时间元素，可以用于指定任务的执行时间。 Cron的语法格式 Seconds Minutes Hours...
• CRON表达式

2020-07-17 18:24:15
CRON表达式
• 只执行一次的定时任务 红色框里面的为cron表达式，从左往右分别为秒/分/时/日/月/年 具体是那一天执行一次就不用加（？...cron表达式这样写就可以了，只会执行一次，然后就不会再执行了。 ...
• Cron表达式个字符串，字符串以5或6个空格隔开，分为6或7个域，每一个域代表个含义，Cron有如下两种语法格式：  Seconds Minutes Hours DayofMonth Month DayofWeek Year或 Seconds Minutes Hours DayofMonth...

...