Search code examples
grailscronquartz-schedulerjobs

What is the cron definition for each minute for a job in grails?


I'm using Quartz plugin for Grails for a synchronized job minute by minute, but I'm unable to use the 0 * * * * * definition and is throwing some exception:

Error loading plugin manager: Unable to locate constructor with Class parameter for class grails.plugins.quartz.DefaultGrailsJobClass (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)

Caused by: java.lang.IllegalArgumentException: Cron expression '0 * * * * *' in the job class cl.ionix.softoken.jobs.SendRefreshStatusByMinuteJob is not a valid cron expression

What can be the correct cron expression to execute every minute?


Solution

  • You can use this:

    0 0/1 * * * ?
    

    According to the doc

    Either Day-of-Week or Day-of-Month must be "?", or you will get an error since support by the underlying library is not complete. So you can't specify both fields, nor leave both as the all values wildcard "*"; this is a departure from the unix crontab specification.