name_masked
name_masked

Reputation: 9803

Schedule Cron/Quartz job immediately

I want to schedule job that would run immediately once the server is up, but run only once. I am not able to find the valid values to do the same. I tried this: 0/1 ? ? ? ? ?, but nothing seems to be getting scheduled. Assuming I am correct about the cron format for Quartz i.e <secs> <mins> <hrs> <dayofmonth> <month> <dayofweek>

Can anyone help me out ?

Upvotes: 3

Views: 2663

Answers (1)

Tomasz Nurkiewicz
Tomasz Nurkiewicz

Reputation: 341003

Cron trigger is an overkill here, use a SimpleTrigger instead:

SimpleTrigger trigger = (SimpleTrigger) newTrigger() 
  .startAt(new Date())  //now
  .build();

Upvotes: 4

Related Questions