9:00:30 开始,每 30 秒执行一次 cron?

问题描述 投票:0回答:1

有没有办法设置每天早上9:00:30开始,每30秒执行一次,直到9:30:00?

我的表情是

30/30 0-30 9 ? * MON-SUN
,但它不能如我所愿

--编辑--

现在是9:00到9:30,计划将在30秒后执行

9:00:30 executed 
9:01:30 executed 
9:02:30 executed 
9:03:30 executed 
9:04:30 executed
...
...
9:30:30 executed

我想要的工作

9:00:30 executed
9:01:00 executed
9:01:30 executed
9:02:00 executed
9:02:30 executed
9:03:00 executed
9:03:30 executed
...
...
9:30:00 executed

请帮助

java cron quartz-scheduler quartz
1个回答
0
投票

您可以使用两个 cron 表达式来实现您想要的:

  1. 30 0-29 9 * * ?

从09:00:30到09:29:30每分钟执行一次

Output

09:00:30
09:01:30
09:02:30
09:03:30
09:04:30
...
09:29:30
  1. 0 1-30 9 * * ?

从 09:01:00 到 09:30:00 每分钟执行一次

Output

09:01:00
09:02:00
09:03:00
09:04:00
09:05:00
...
09:30:00
© www.soinside.com 2019 - 2024. All rights reserved.