An easier way is to start the servlet automatically when the *server*
starts. In catalina you should have the following settings in your web.xml
file.

/colin

<snip>
    <servlet>
        <servlet-name>foo</servlet-name>
        <servlet-class>
            org.apache.turbine.Turbine
        </servlet-class>
        <init-param>
            <param-name>properties</param-name>
            <!-- This is relative to the docBase -->
            <param-value>
                /WEB-INF/conf/TurbineResources.properties
            </param-value>
        </init-param>
        <load-on-startup>
            1
        </load-on-startup>
    </servlet>
</snip>

----- Original Message -----
From: "Gareth Coltman" <[EMAIL PROTECTED]>
To: "Turbine Users List" <[EMAIL PROTECTED]>
Sent: Thursday, February 21, 2002 2:29 PM
Subject: RE: How to start Scheduler automatically!!


> One easy way would be to fire off a command line HTTP request from your
> startup script to the action below. http@ can be called from a unix script
> like:
>
> http@ host page port
>
> Hope this helps
>
>
>
> > -----Original Message-----
> > From: Fabio Daprile [mailto:[EMAIL PROTECTED]]
> > Sent: 21 February 2002 10:36
> > To: Turbine Users List
> > Subject: How to start Scheduler automatically!!
> >
> >
> > Hello Gentlemen,
> >
> > I've implemented the scheduler service in my application.
> >
> > I  use the turbine_scheduled_job table to keep the jobs.
> >
> > The problem is that i need to start the scheduler when the
> > servlets starts.
> > Now i start the scheduler calling an action from an HTML page, and you
> > can see the code of this action below.
> >
> > Can i do this automatically?
> >
> > Thank you in advance.
> >
> > Best Regards,
> >
> > Fabio Daprile.
> > Systems engineer.
> >
> > W�rth Phoenix International
> >
> >
> > /**
> >  * Title:        Bug tracking system
> >  * Description:  Development of a Bug Tracking and Enhancement request
> > system
> >  * Copyright:    Copyright (c) 2001
> >  * Company:
> >  * @author Fabio Daprile
> >  * @version 1.0
> >  */
> >
> > file://Turbine
> > import org.apache.velocity.context.Context;
> > import org.apache.turbine.util.RunData;
> > import org.apache.turbine.services.schedule.JobEntry;
> > import org.apache.turbine.services.schedule.JobEntryPeer;
> > import org.apache.turbine.services.schedule.ScheduleService;
> > import org.apache.turbine.services.schedule.TurbineSchedulerService;
> > import org.apache.turbine.services.TurbineServices;
> > import org.apache.turbine.modules.actions.VelocityAction;
> > import org.apache.turbine.util.ParameterParser;
> > import org.apache.turbine.util.db.Criteria;
> >
> > import java.util.*;
> >
> >
> > public class SchedulerStart extends VelocityAction
> > {
> >
> >      public void doPerform(RunData data, Context context) throws
Exception
> >      {
> >         Criteria _criteria = null;
> >         Criteria.Criterion _criterion1 = null;
> >
> >         Vector _schedulerParams = null;
> >         JobEntry je;
> >         ParameterParser params = data.getParameters();
> >
> >         _criteria = new Criteria();
> >         _criterion1 = _criteria.getNewCriterion(JobEntryPeer.OID,
> >                                                  new Integer(0),
> >
Criteria.GREATER_THAN);
> >         try
> >         {
> >           _schedulerParams = JobEntryPeer.doSelect(_criteria);
> >         }
> >         catch(Exception e)
> >         {
> >           e.printStackTrace();
> >         }
> >
> >         try
> >         {
> >             file://access the service singleton
> >             TurbineSchedulerService ss =
> > (TurbineSchedulerService)TurbineServices.getInstance().getService(
> TurbineSchedulerService.SERVICE_NAME);
> >
> >             ss.init(data.getServletConfig());
> >
> >             file://set the Message
> >             file://System.out.println("Task started successfully");
> >
> >             file://System.out.println(ss.listJobs().size());
> >         }
> >         catch (Exception e)
> >         {
> >             file://set the Message
> >             data.setMessage("Task failed to start!");
> >         }
> >
> >         file://setTemplate(schedule,SchedulerStatus.vm);
> >
> >      }
> > }
> >
> >
> > --
> >
> >
> > W�rth Phoenix Srl
> > Via Kravogl 4, I-39100 Bolzano
> > Tel: +39 0471/564111
> > Fax: +39 0471/564122
> >
> > mailto:[EMAIL PROTECTED]
> > http://www.wuerth-phoenix.com
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> >
> >
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to