I have just a day to get this working. These are production machines, so
I can't deploy anything to them.

I'm using sshexec to remotely ping from a unix host and using rcmd to
remotely ping from a windows host. I redirect the output from these
tasks to a file and then use loadfile with a filterchain to load the
ipaddress into a property.

This works all fine and dandy except I need to do it in a loop, so that
led me to the script task. But I was having problems getting the
ipaddress set by loadfile back to the script. I didn't want to create
20x100 properties, but if that's what it takes, so be it.

Thanks for your help.

-----Original Message-----
From: Steve Loughran [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 18, 2006 10:25 AM
To: Ant Users List
Subject: Re: Problem with script task and properties


Dick, Brian E. wrote:
> This is a simplified script. I need to execute the script body several
> hundred times in a loop. I also need to run about twenty of them in
> parallel. Here's my business problem and the pseudo code for the
> solution. Maybe you can suggest another approach.
> 
> Problem: Simultaneously detect a DNS ip address change on twenty
remote
> hosts (window and unix).
> 
> Solution:
> <for param="remotehost" list="host1..host20" parallel="true">
>    <sequence>
>       <remotepinguntil remotehost="@{host}" pinghost="theDNSHost"
> ipaddress="123.456.789.012"/>
>    </sequence>
> </for>
> <macrodef name="remotepinguntil">
>    <attribute name="remotehost"/>
>    <attribute name="pinghost"/>
>    <attribute name="ipaddress"/>
>    <!--
>      On @{remotehost} ping @{pinghost} until the ipaddress =
> @{ipaddress}
>    -->
> </macrodef>

1. I think you will get burned by the JVM's caching of IP addresses if 
you are not careful; you need to run jvms with IPAddr caching set to a 
second or two instead of forever.

2. If I had something this complex I'd probably drop to java, use the 
java1.5 ping api. If the nodes were all running smartfrog I'd deploy 
components onto each box that do their own testing, and fail if the 
condition is not met within a specified time period. Then I'd deploy 
them with a parent component that runs them all and fails if one of the 
children fail; have my hosted ant task do a blocking deployment of that 
and be laughing.

3. Ant1.7 will have an <isreachable> condition that works on java1.5.

4.  arp is the power tool for such situations; there is no ant task for 
it (yet).

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

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

Reply via email to