You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Melissa Hao <me...@oracle.com> on 2003/02/28 18:35:45 UTC
getting the exec task to run a script which spawns a child process
Hi,
I use the exec task to run a shell script called foo.sh. foo.sh has "bar &" inside of it, which spawns a background child process. foo.sh finishes pretty quickly, but the exec task waits for bar to finish before moving on. This is a problem for me because bar is supposed to run indefinitely.
I searched this mailing list but I haven't found my exact problem. I found http://marc.theaimsgroup.com/?l=ant-user&m=100621497023872&w=2, which explains a workaround for getting foo.sh to run indefinitely. Do I use the same workaround to get bar to run indefeintely?
thanks
Melissa
Re: getting the exec task to run a script which spawns a child process
Posted by Antoine Levy-Lambert <le...@tiscali-dsl.de>.
have a look at this posting from Bill Burton :
http://marc.theaimsgroup.com/?l=ant-user&m=104322316306620&w=2
Subject: [SUBMIT] Support for detached <exec> on Unix and Windows
Antoine
----- Original Message -----
From: "Melissa Hao" <me...@oracle.com>
To: <us...@ant.apache.org>
Sent: Friday, February 28, 2003 6:35 PM
Subject: getting the exec task to run a script which spawns a child process
> Hi,
>
> I use the exec task to run a shell script called foo.sh. foo.sh has "bar
&" inside of it, which spawns a background child process. foo.sh finishes
pretty quickly, but the exec task waits for bar to finish before moving on.
This is a problem for me because bar is supposed to run indefinitely.
>
> I searched this mailing list but I haven't found my exact problem. I
found http://marc.theaimsgroup.com/?l=ant-user&m=100621497023872&w=2, which
explains a workaround for getting foo.sh to run indefinitely. Do I use the
same workaround to get bar to run indefeintely?
>
>
> thanks
> Melissa
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
Re: getting the exec task to run a script which spawns a child process
Posted by Melissa Hao <me...@oracle.com>.
Thanks Bill, that simple solution worked great.
I have another question. It seems like a simple question but I couldn't find the answer to it. How do I echo the contents of a file?
thanks
Melissa
Bill Burton wrote:
> Hello,
>
> Melissa Hao wrote:
> > Hi,
> >
> > I use the exec task to run a shell script called foo.sh. foo.sh has "bar &" inside of it, which spawns a background child process. foo.sh finishes pretty quickly, but the exec task waits for bar to finish before moving on. This is a problem for me because bar is supposed to run indefinitely.
> >
> > I searched this mailing list but I haven't found my exact problem. I found http://marc.theaimsgroup.com/?l=ant-user&m=100621497023872&w=2, which explains a workaround for getting foo.sh to run indefinitely. Do I use the same workaround to get bar to run indefeintely?
>
> I posted a more recent version you can read at
> http://marc.theaimsgroup.com/?l=ant-user&m=104322316306620&w=2.
>
> But all you need to do in foo.sh is call bar like this:
> nohup bar </dev/null > bar.out 2>&1 &
> so that all of stdin, stdout and stderr are redirected before putting it
> in the background.
>
> -Bill
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
Re: getting the exec task to run a script which spawns a child process
Posted by Melissa Hao <me...@oracle.com>.
I tried this; now the exec task doesn't hang but the bar process still stops when the ant process stops. Is there a way to get bar to run indefinitely?
--
thanks
Melissa
Bill Burton wrote:
> Hello,
>
> Melissa Hao wrote:
> > Hi,
> >
> > I use the exec task to run a shell script called foo.sh. foo.sh has "bar &" inside of it, which spawns a background child process. foo.sh finishes pretty quickly, but the exec task waits for bar to finish before moving on. This is a problem for me because bar is supposed to run indefinitely.
> >
> > I searched this mailing list but I haven't found my exact problem. I found http://marc.theaimsgroup.com/?l=ant-user&m=100621497023872&w=2, which explains a workaround for getting foo.sh to run indefinitely. Do I use the same workaround to get bar to run indefeintely?
>
> I posted a more recent version you can read at
> http://marc.theaimsgroup.com/?l=ant-user&m=104322316306620&w=2.
>
> But all you need to do in foo.sh is call bar like this:
> nohup bar </dev/null > bar.out 2>&1 &
> so that all of stdin, stdout and stderr are redirected before putting it
> in the background.
>
> -Bill
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
Re: getting the exec task to run a script which spawns a child process
Posted by Bill Burton <bi...@progress.com>.
Hello,
Melissa Hao wrote:
> Hi,
>
> I use the exec task to run a shell script called foo.sh. foo.sh has "bar &" inside of it, which spawns a background child process. foo.sh finishes pretty quickly, but the exec task waits for bar to finish before moving on. This is a problem for me because bar is supposed to run indefinitely.
>
> I searched this mailing list but I haven't found my exact problem. I found http://marc.theaimsgroup.com/?l=ant-user&m=100621497023872&w=2, which explains a workaround for getting foo.sh to run indefinitely. Do I use the same workaround to get bar to run indefeintely?
I posted a more recent version you can read at
http://marc.theaimsgroup.com/?l=ant-user&m=104322316306620&w=2.
But all you need to do in foo.sh is call bar like this:
nohup bar </dev/null > bar.out 2>&1 &
so that all of stdin, stdout and stderr are redirected before putting it
in the background.
-Bill