cron - Run a job every X days but only between two specific dates and times -
cron - Run a job every X days but only between two specific dates and times -
i think title says all.
i run job e.g. starts @ jun 19 2014 (say @ 7 am), ends @ dec 25 2015 (say @ 11 pm) , runs every 9 days in between these 2 dates. can set work without end date. don't know how include of in 1 expression.
update: adding endat()
triggerbuilder
work?
mytrigger = (icrontrigger)triggerbuilder.create() .withidentity(triggername, triggergroup) .withcronschedule(cron) .endat(xxxx) .build();
you're in right direction, schedules need lot of research generated cron look can generated via api. example, trigger want following:
var startdate = new datetime(2014, 06, 19, 7, 0, 0); var enddate = new datetime(2015, 12, 25, 23, 0, 0); var cronexpression = "0 0 12 1/9 * ? *"; //every 9 days itrigger trig = triggerbuilder.create() .startat(startdate) .withcronschedule(cronexpression) .withdescription("description") .withidentity(triggerkey) .withpriority(1) .endat(enddate) .build();
if want see cron look generated:
icrontrigger trigger = (icrontrigger)trig; string cronexpression = trigger.cronexpressionstring;
cron quartz-scheduler
Comments
Post a Comment