我正在尝试设置一个工作,使其在我的调度程序第一次启动时运行,然后在每天的午夜运行一次。这是我的工作和触发器的XML。每天一次触发工作,但一次性触发不起作用。
<job>
<name>MyJob</name>
<group>MyJobGroup</group>
<job-type>MyScheduledJob, MyJobAssembly</job-type>
<description>My job, yo</description>
<durable>true</durable>
<recover>false</recover>
</job>
<trigger>
<cron>
<name>MyTrigger</name>
<group>MyTriggerGroup</group>
<job-name>MyJob</job-name>
<job-group>MyJobGroup</job-group>
<cron-expression>0 0 0 1/1 * ? *</cron-expression>
</cron>
<simple>
<name>MyOneTimeTrigger</name>
<group>MyTriggerGroup</group>
<description>Run once at startup, G</description>
<misfire-instruction>SmartPolicy</misfire-instruction>
<volatile>false</volatile>
<job-name>MyJob</job-name>
<job-group>MyJobGroup</job-group>
<repeat-count>0</repeat-count>
<repeat-interval>0</repeat-interval>
</simple>
</trigger>
答案 0 :(得分:2)
无法正常工作我想你的意思是触发器永远不会触发。也许是因为它没有延迟它会失败?如何在将来的某个时间添加<start-time-seconds-in-future/>
呢?
<simple>
<name>MyOneTimeTrigger</name>
<group>MyTriggerGroup</group>
<description>Run once at startup, G</description>
<misfire-instruction>SmartPolicy</misfire-instruction>
<volatile>false</volatile>
<job-name>MyJob</job-name>
<job-group>MyJobGroup</job-group>
<start-time-seconds-in-future>60</start-time-seconds-in-future>
<repeat-count>0</repeat-count>
<repeat-interval>0</repeat-interval>
</simple>
如果它对你有用,你必须知道你可能认为是错误或功能的东西:如果你重新启动服务器,因为触发器已经被触发并被删除,它将再次触发。请参阅:Quartz XML plugin reschedules fired triggers after restart。