quartz scheduler - Cron Expression - Run every hour after a start time -
i want run cron job every hour after start time. cron job expression
cronexpression = seconds + " " + minutes + " " + hours +"/1" + " " + " * * ? *" ;
(seconds, minutes, hours passed in user selection)
the job starts @ right time , runs every hour until midnight stops until hour on next day , resumes. how job continuously run , not stop @ midnight?
i understand can change expression
cronexpression = seconds + " " + minutes + " " * * * ? *" ;
but not take account start time. run @ every hour.
thanks in advance, rich
do mean want job start @ given time , run once hourly forever? if so, don't think cron expression right approach.
if you're using scheduler should straightforward start job , run forever @ given interval. example, here's snippet quartz scheduler docs jobbuilder:
jobdetail job = newjob(myjob.class) .withidentity("myjob") .build(); trigger trigger = newtrigger() .withidentity(triggerkey("mytrigger", "mytriggergroup")) .withschedule(simpleschedule() .withintervalinhours(1) .repeatforever()) .startat(futuredate(10, minutes)) .build(); scheduler.schedulejob(job, trigger);
Comments
Post a Comment