[opencms-dev] Scheduled task
Samuel Shum Hiu Yeung (FS)
sshum at frontline.com.sg
Wed Mar 5 03:10:55 CET 2003
Thanks Andrea,
I am actually trying to write a scheduled task to do publishing and/or
synchonization the website contents daily, e.g. for news publishing. So I am
looking for the API that is to be called for publishing from the cronjob
class. And I guess it shall be com.opencms.workplace.CmsAdminProjectPublish
or CmsAdminPublishProjectThread
But it requires parameters like the CmsObject, projectId, CmsSession etc...,
which may not be intuitive to be constructed in the cronjob class.
Does anyone who has done this before? Or already there is such feature in
Opencms?
Thanks for the guidance,
Samuel
----- Original Message -----
From: "Andreas Zahner" <A.Zahner at alkacon.com>
To: <opencms-dev at www.opencms.org>
Sent: Tuesday, March 04, 2003 8:26 PM
Subject: AW: [opencms-dev] Scheduled task
Samuel,
you can use "Scheduled tasks" to run special tasks in OpenCms, e.g. send
a Newsletter every month, check something every 30 minutes etc.
In the OpenCms backoffice, you have to enter the following information
(separated by a space):
Minute, hour, day, month, day of week, user, group, java class,
parameter.
An example for the backoffice entry:
"6 12 * * * Admin Administrators your.package.ClassName aParam" runs
your class every day at 12.06 am as user Admin in the Administrators
group.
Further examples for adjusting the time:
"5 12 * * 0" runs your class every Monday at 12.05,
"30 11 24 12 *" runs your class every year on December, 24th at 11.30
Your Java class has to implement the class I_CmsCronJob (package
com.opencms.core) and provide a method "launch" which will be executed.
Example:
/**
* This method is called by the scheduler.<p>
*
* @param CmsObject the Cms object
* @param parameter the parameters entered in the backoffice
* @return String String that is written to the opencms log
*/
public String launch(CmsObject cms, String parameter) throws
IOException, CmsException {
// enter your code here!!
return "Scheduler launched successfully!";
}
Now you should be able to create your own scheduled tasks.
Regards,
Andreas Zahner
Alkacon Software - The OpenCms Experts
http://www.alkacon.com
-----Ursprüngliche Nachricht-----
Von: owner-opencms-dev at www.opencms.org
[mailto:owner-opencms-dev at www.opencms.org] Im Auftrag von Samuel Shum
Hiu Yeung (FS)
Gesendet: Dienstag, 4. März 2003 11:09
An: opencms-dev at www.opencms.org
Betreff: [opencms-dev] Scheduled task
Hi,
I think Scheduled Task is a new feature in opencms 5.0.
Can anyone provide me an example or some kind of writeup on how to use
it? Or please direct me to a place that I can get the information on
using it?
Thanks so much,
Samuel
More information about the opencms-dev
mailing list