我正在尝试每天在特定时间和服务器启动时运行一项工作,以确保数据是最新的。不幸的是,我不知道如何使用 xml 文件将石英设置为在服务器启动时运行。这是我的日程安排:
<schedule>
<job>
<name>UpdateDashboardStats</name>
<group>UpdateDashboardStats</group>
<description>Updating Dashboard Statistics</description>
<job-class>utils.UpdateDashboardStats</job-class>
</job>
<trigger>
<cron>
<name>UpdateDashboardStats</name>
<job-name>UpdateDashboardStats</job-name>
<job-group>UpdateDashboardStats</job-group>
<!-- It will run at 1am every day -->
<cron-expression>0 0 1 * * ?</cron-expression>
</cron>
</trigger>
<trigger>
<simple>
<name>UpdateDashboardStatsStartup</name>
<job-name>UpdateDashboardStats</job-name>
<job-group>UpdateDashboardStats</job-group>
<description>Run once at startup</description>
<misfire-instruction>SmartPolicy</misfire-instruction>
<repeat-count>0</repeat-count>
<repeat-interval>10</repeat-interval>
</simple>
</trigger>
</schedule>