In opencms there are job scheduler that we can schedule opencms to run jobs by schedule it in style UNIX cron job. To create a job you have to write a piece of java code that implements I_CmsScheduleJob, and override method public String launch(CmsObject arg0, Map arg1).
--------------------------------------------------------------------------------------------
package com.thaibloger.utils;
import java.util.Date;
import org.opencms.scheduler.*;
public class TestSchedule implements I_CmsScheduledJob {
public String launch(CmsObject arg0, Map arg1) throws Exception {
// TODO Auto-generated method stub
System.out.println("xxxxxxxxx JOBs : "+ new Date());
return null;
}
}
---------------------------------------------------------------------------------------------
Then put the class in to your opencms WEB-INF/classes or pack it as .jar then put it in WEB-INF/libs of opencms, now restart.
In opencms console Administration view > Scheduled Jobs Management, create a job then specific the java class to run job set schedule by select cron expression.
then activate it, Vola ... that's all.
for more infomation about cron expression you can find it here, more information opencms use Quartz to implement jobschedule.
No comments:
Post a Comment