class MyJob {
static triggers = {
simple name: 'everyMinute', repeatInterval: 60000
cron name: 'everyMorning', cronExpression: '0 0 6 * * ?'
}
void execute() {
println 'Job run!'
}
}
Trigger Usage
A trigger determines when a job runs. Triggers are declared in the static triggers block of a job class in grails-app/jobs, and a job may declare as many as it needs:
Three trigger types are available: simple, cron, and custom. Every trigger accepts a name — which must be unique across the whole application — a group, and a startDelay in milliseconds.
Refer to the user guide topic on Triggers for more information.