grails quartz 作业永远不会被执行
grails quartz job never gets executed
我有这份工作:
class MyJob {
static triggers = {
cron name:"some job", cronExpression:"0 0 * * * ? *"
}
def execute() {
log.info "job runs"
}
}
作业应该 运行 每小时。我认为问题出在 cronExpression 上。这就是为什么我将其更改为上面的表达式。在我有这个表达之前:
0 0 0/1 1/1 * ? *
但是 none 的表达式有效。
我的设置:
我有 10 个作业 运行 每 5 分钟到每月一次。
每份工作似乎 运行 除了这个...
我的问题:
- 为什么作业没有执行?
- 是否有一个 max_jobs 参数负责这个?
不带年份试试:
static triggers = {
cron name: 'myTrigger', cronExpression: "0 0 0-23 * * ?"
}
你可以控制它f.e。通过预测执行时间并准备适当的表达式(每月仅触发两次;在每月的第一天凌晨 1 点和 2 点):
static triggers = {
cron name: 'myTrigger', cronExpression: "0 0 1-2 1 * ?"
}
阅读更多关于different types of triggers的信息:
Currently plugin supports three types of triggers:
- simple — executes once per defined interval (ex. “every 10 seconds”);
- cron — executes job with cron expression (ex. “at 8:00am every Monday through Friday”);
- custom — your implementation of Trigger interface.
还记得:
The triggers name property must be unique across all triggers in the
application.
By default, jobs will not be executed when running under the test
environment.
您可以找到更多示例 here。
我有这份工作:
class MyJob {
static triggers = {
cron name:"some job", cronExpression:"0 0 * * * ? *"
}
def execute() {
log.info "job runs"
}
}
作业应该 运行 每小时。我认为问题出在 cronExpression 上。这就是为什么我将其更改为上面的表达式。在我有这个表达之前:
0 0 0/1 1/1 * ? *
但是 none 的表达式有效。
我的设置:
我有 10 个作业 运行 每 5 分钟到每月一次。 每份工作似乎 运行 除了这个...
我的问题:
- 为什么作业没有执行?
- 是否有一个 max_jobs 参数负责这个?
不带年份试试:
static triggers = { cron name: 'myTrigger', cronExpression: "0 0 0-23 * * ?" }
你可以控制它f.e。通过预测执行时间并准备适当的表达式(每月仅触发两次;在每月的第一天凌晨 1 点和 2 点):
static triggers = { cron name: 'myTrigger', cronExpression: "0 0 1-2 1 * ?" }
阅读更多关于different types of triggers的信息:
Currently plugin supports three types of triggers:
- simple — executes once per defined interval (ex. “every 10 seconds”);
- cron — executes job with cron expression (ex. “at 8:00am every Monday through Friday”);
- custom — your implementation of Trigger interface.
还记得:
The triggers name property must be unique across all triggers in the application.
By default, jobs will not be executed when running under the test environment.
您可以找到更多示例 here。