ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Burton <>
Subject Re: antRunAsync and getting a background process to run indefinitely
Date Thu, 17 Apr 2003 15:50:32 GMT

Melissa Hao wrote:
> Hi,
> I'm having trouble getting the antRunAsync workaround to work exactly the way I want.
> I use antRunAsync to run a shell script called  The shell script is started
asynchronously, which is great.  The shell script spawns a java process in the background
(eg, "java &").  I would like this java process to continue running after the
ant process completes.  Currently, the java process stops when the ant process stops.  Is
there any way to get the java process to run indefinitely?

I'm a little puzzled as to why this would be happening.  First, your script would already be run in the background by the antRunAsync 
script.  If the only thing (or the last thing) your script does is to 
start "java" in the background, the "&" isn't necessary.  Only 
if you want to start another process without waiting for that to 
complete would you need to put your java command in the background.

Can you run the bgtest script and build file included in the archive to 
see if you have the same problem?

Although this shouldn't be necessary, you could try redirecting all the 
standard file descriptors, i.e.
     java </dev/null > 2>&1 &
This is what antRunAsync does if you specify
     <env key="ANTRUN_OUTPUT" value="some-output-file" />
to <exec> so it shouldn't be necessary.

What OS are you running on and what shell are you using?  Before posting 
antRunAsync, the only UNIX OS I'd tested on was Solaris 2.8.  But in 
theory, it should work the same way on all other UNIX OS's.


View raw message