import-bot (20211) [Avatar] Offline
#1
[Originally posted by kwutzke]

Hi!

How do I run a background task to start Tomcat 4.1 in Ant? I want to start the
server, if it is not running yet. However, the <exec> and <java> tasks I tried
don't seem to be able to do that. I also tried <parallel>, but Ant just seems
to hang on that task.

The target I wrote:

<property name="local.bootstrap.class">
value="org.apache.catalina.startup.Bootstrap"/>
<property name="local.bootstrap.jar.file">
location="${env.CATALINA_HOME}/bin/bootstrap.jar"/>

<path id="local.bootstrap.classpath">
<pathelement path="${local.bootstrap.jar.file}"/>
</path>

<target name="start-local" description="Attempts to start local Tomcat.">

<!-- server already running? yes:bye (or restart?), no:startup -->

<java classname="${local.bootstrap.class}" fork="true">
<classpath refid="local.bootstrap.classpath"/>
<arg value="start"/>
<sysproperty key="java.endorsed.dirs">
value="${env.CATALINA_HOME}/bin:${env.CATALINA_HOME}/common/endorsed"/>
<sysproperty key="catalina.base" value="${env.CATALINA_HOME}"/>
<sysproperty key="catalina.home" value="${env.CATALINA_HOME}"/>
<sysproperty key="java.io.tmpdir" value="${env.CATALINA_HOME}/temp"/>
</java>
</target>

The Java system properties were drawn from the startup scripts in the Tomcat
bin directory, especially catalina.sh.

The task works fine. It starts up the server, however... Ant hangs, because
the task is not run in the background...
Can it be done, so that the task is spawnes in the background? What about the
<spawn> task I've heard about?

Karsten
import-bot (20211) [Avatar] Offline
#2
Re: Background tasks to start Tomcat 4.1
[Originally posted by steve_l]


There is no <spawn> task yet; though a fair few requests for one. It is
awaiting someone to rise to the challenge of writing one that works on all
supported platforms.

Sometimes you can use the shell to start stuff in the background, (nohup
startup.sh&smilie, or START in cmd.exe...run the shell in <exec> and pass in the
command there. Sometimes that works.