You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Krish <ak...@yahoo.co.in> on 2007/05/24 19:06:35 UTC

Waiting for task to succeed

Hi

I have a requirement wherein I need to make sure the 
process doesnt exist. So I need to do something like
this -

`netstat -tln | grep 8080 | cut -f1 -d'.

If the return value of the above is tcp, then i know
that a process is running ..... I need to run this
command in a loop until the process dies out. Right
now, there is no way of knowing how long it takes for
the process to die (1 min or 2 min etc)....Also i
looked at <exec> task, but there is no way of placing
this task in a conditional loop. Or if there is way, I
am not sure how to proceed.

I also looked at <waitFor> but I cannot use <waitFor>
and <exec> together.


Let me know how to proceed with this.

Thanks
K

_____________________________________________________
*Half of being smart is knowing what you're dumb at
*To err is human--and to blame it on a computer is even more so
*Gravity is not responsible for people falling in love


      Did you know? You can CHAT without downloading messenger. Click here http://in.messenger.yahoo.com/webmessengerpromo.php

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Waiting for task to succeed

Posted by Krish <ak...@yahoo.co.in>.
Yea...thats what i am doing now :)...Seems easier that
way

Thanks much
K
--- David Weintraub <qa...@gmail.com> wrote:

> Why not write a shell script and then have the shell
> script execute
> the loop? All the <exec> task would have to do is
> execute the shell
> script. The shell script can return a non-zero exit
> code on failure.
> 
> On 5/24/07, Krish <ak...@yahoo.co.in> wrote:
> > Hi
> >
> > I have a requirement wherein I need to make sure
> the
> > process doesnt exist. So I need to do something
> like
> > this -
> >
> > `netstat -tln | grep 8080 | cut -f1 -d'.
> >
> > If the return value of the above is tcp, then i
> know
> > that a process is running ..... I need to run this
> > command in a loop until the process dies out.
> Right
> > now, there is no way of knowing how long it takes
> for
> > the process to die (1 min or 2 min etc)....Also i
> > looked at <exec> task, but there is no way of
> placing
> > this task in a conditional loop. Or if there is
> way, I
> > am not sure how to proceed.
> >
> > I also looked at <waitFor> but I cannot use
> <waitFor>
> > and <exec> together.
> >
> >
> > Let me know how to proceed with this.
> >
> > Thanks
> > K
> >
> >
>
_____________________________________________________
> > *Half of being smart is knowing what you're dumb
> at
> > *To err is human--and to blame it on a computer is
> even more so
> > *Gravity is not responsible for people falling in
> love
> >
> >
> >       Did you know? You can CHAT without
> downloading messenger. Click here
> http://in.messenger.yahoo.com/webmessengerpromo.php
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> user-help@ant.apache.org
> >
> >
> 
> 
> -- 
> --
> David Weintraub
> qazwart@gmail.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 


_____________________________________________________
*Half of being smart is knowing what you're dumb at
*To err is human--and to blame it on a computer is even more so
*Gravity is not responsible for people falling in love


		
__________________________________________________________
Yahoo! India Answers: Share what you know. Learn something new
http://in.answers.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Waiting for task to succeed

Posted by David Weintraub <qa...@gmail.com>.
Why not write a shell script and then have the shell script execute
the loop? All the <exec> task would have to do is execute the shell
script. The shell script can return a non-zero exit code on failure.

On 5/24/07, Krish <ak...@yahoo.co.in> wrote:
> Hi
>
> I have a requirement wherein I need to make sure the
> process doesnt exist. So I need to do something like
> this -
>
> `netstat -tln | grep 8080 | cut -f1 -d'.
>
> If the return value of the above is tcp, then i know
> that a process is running ..... I need to run this
> command in a loop until the process dies out. Right
> now, there is no way of knowing how long it takes for
> the process to die (1 min or 2 min etc)....Also i
> looked at <exec> task, but there is no way of placing
> this task in a conditional loop. Or if there is way, I
> am not sure how to proceed.
>
> I also looked at <waitFor> but I cannot use <waitFor>
> and <exec> together.
>
>
> Let me know how to proceed with this.
>
> Thanks
> K
>
> _____________________________________________________
> *Half of being smart is knowing what you're dumb at
> *To err is human--and to blame it on a computer is even more so
> *Gravity is not responsible for people falling in love
>
>
>       Did you know? You can CHAT without downloading messenger. Click here http://in.messenger.yahoo.com/webmessengerpromo.php
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


-- 
--
David Weintraub
qazwart@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Waiting for task to succeed

Posted by "Alexey N. Solofnenko" <A....@mdl.com>.
Please also look for <retry> task in this mailing list.

- Alexey.

Alexey N. Solofnenko wrote:
> There is <socket> to check for ports, but no "while". I would suggest 
> using <scriptdef> and write it in a code.
>
> - Alexey.
>
> Krish wrote:
>> Hi
>>
>> I have a requirement wherein I need to make sure the process doesnt 
>> exist. So I need to do something like
>> this -
>>
>> `netstat -tln | grep 8080 | cut -f1 -d'.
>>
>> If the return value of the above is tcp, then i know
>> that a process is running ..... I need to run this
>> command in a loop until the process dies out. Right
>> now, there is no way of knowing how long it takes for
>> the process to die (1 min or 2 min etc)....Also i
>> looked at <exec> task, but there is no way of placing
>> this task in a conditional loop. Or if there is way, I
>> am not sure how to proceed.
>>
>> I also looked at <waitFor> but I cannot use <waitFor>
>> and <exec> together.
>>
>>
>> Let me know how to proceed with this.
>>
>> Thanks
>> K
>>
>> _____________________________________________________
>> *Half of being smart is knowing what you're dumb at
>> *To err is human--and to blame it on a computer is even more so
>> *Gravity is not responsible for people falling in love
>>
>>
>>       Did you know? You can CHAT without downloading messenger. Click 
>> here http://in.messenger.yahoo.com/webmessengerpromo.php
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>   
>

-- 
------------------------------------------------------------------------
Alexey N. Solofnenko <http://trelony.cjb.net/>
Pleasant Hill, CA (GMT-8 usually)

Re: Waiting for task to succeed

Posted by Steve Loughran <st...@apache.org>.
Alexey N. Solofnenko wrote:
> There is <socket> to check for ports, but no "while". I would suggest 
> using <scriptdef> and write it in a code.
> 

There is <waitfor>, that blocks until a condition is met


<waitfor maxwait="20"  maxwaitunit="second" checkevery="500">
  <not>
   <socket port="8080" server="localhost" />
  </not>
  <waitfor>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Waiting for task to succeed

Posted by "Alexey N. Solofnenko" <A....@mdl.com>.
There is <socket> to check for ports, but no "while". I would suggest 
using <scriptdef> and write it in a code.

- Alexey.

Krish wrote:
> Hi
>
> I have a requirement wherein I need to make sure the 
> process doesnt exist. So I need to do something like
> this -
>
> `netstat -tln | grep 8080 | cut -f1 -d'.
>
> If the return value of the above is tcp, then i know
> that a process is running ..... I need to run this
> command in a loop until the process dies out. Right
> now, there is no way of knowing how long it takes for
> the process to die (1 min or 2 min etc)....Also i
> looked at <exec> task, but there is no way of placing
> this task in a conditional loop. Or if there is way, I
> am not sure how to proceed.
>
> I also looked at <waitFor> but I cannot use <waitFor>
> and <exec> together.
>
>
> Let me know how to proceed with this.
>
> Thanks
> K
>
> _____________________________________________________
> *Half of being smart is knowing what you're dumb at
> *To err is human--and to blame it on a computer is even more so
> *Gravity is not responsible for people falling in love
>
>
>       Did you know? You can CHAT without downloading messenger. Click here http://in.messenger.yahoo.com/webmessengerpromo.php
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>   

-- 
------------------------------------------------------------------------
Alexey N. Solofnenko <http://trelony.cjb.net/>
Pleasant Hill, CA (GMT-8 usually)

Re: Waiting for task to succeed

Posted by Doug Lochart <dl...@capecomputing.com>.
I may be being a bit picky but I would not key on a port (which could 
change in a config file) I would target the process name itself with ps 
or pgrep myself.

I haven't done any serious ant dev in a while (my build scripts work 
fine =) but if you have exhausted the core and contrib tasks then you 
might want to build your own task that looks for and then watches (waits 
fir the process to terminate if that is what you want).  Then when your 
task completes the process is stopped.  Remember though that if the 
process is not in the process of dying this task won't return.

just one simple solution of which there are probably better

Krish wrote:
> Hi
>
> I have a requirement wherein I need to make sure the 
> process doesnt exist. So I need to do something like
> this -
>
> `netstat -tln | grep 8080 | cut -f1 -d'.
>
> If the return value of the above is tcp, then i know
> that a process is running ..... I need to run this
> command in a loop until the process dies out. Right
> now, there is no way of knowing how long it takes for
> the process to die (1 min or 2 min etc)....Also i
> looked at <exec> task, but there is no way of placing
> this task in a conditional loop. Or if there is way, I
> am not sure how to proceed.
>
> I also looked at <waitFor> but I cannot use <waitFor>
> and <exec> together.
>
>
> Let me know how to proceed with this.
>
> Thanks
> K
>
> _____________________________________________________
> *Half of being smart is knowing what you're dumb at
> *To err is human--and to blame it on a computer is even more so
> *Gravity is not responsible for people falling in love
>
>
>       Did you know? You can CHAT without downloading messenger. Click here http://in.messenger.yahoo.com/webmessengerpromo.php
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org