Possible to specify start and end time as part of schedule?

I am trying to schedule a job that runs every 5 minutes starting at 1 a.m. and ending at 11 p.m. Here's the expression I am planning to use,

0 0/5 1-23 ? * * *

I have minimal knowledge in cron but based on the JDBC input plugin documentation it uses rufus scheduler whereas the syntax above is more suited towards quartz.

I do understand quartz != cron but what's not clear is would the expression be acceptable for logstash. If not, is there a way to achieve the same behavior with rufus scheduler?

Edit: The expression above doesn't work, logstash throws following error (in log files),

Input plugin raised exception during shutdown, ignoring it. {:plugin=>"jdbc", 
:exception=>"not a valid cronline : '0 0/5 1-23 ? * * *'", :backtrace=>[
"/usr/share/logstash/vendor/bundle/jruby/1.9/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/cronline.rb:61:in 
`initialize'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:604:in 
`initialize'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler.rb:629:in 
`do_schedule'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler.rb:244:in 
`cron'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-4.3.1/lib/logstash/inputs/jdbc.rb:249:in 
`run'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:470:in 
`inputworker'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:463:in `start_input'"]}

Aren't you just specifying too many fields? A cron line has five columns, not seven. For starters, shouldn't you remove the leading zero?

Aren't you just specifying too many fields? A cron line has five columns, not seven. For starters, shouldn't you remove the leading zero?

The syntax is more suited towards use with quartz. My reference point and more on that

Quickly checked here and it appears to a be a valid syntax (for Quartz) with explanation as follows,

At second :00, every 5 minutes starting at minute :00, every hour between 01am and 23pm, of every day

As I said, drop the initial zero since the cron syntax supported by jdbc doesn't support seconds, then drop the last * that represents the year since jdbc doesn't support that either. The ? marker doesn't work either.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.