I am currently executing a deploy using foreach ant task and the list has app server names (2 servers). There is a logic to wait for 2 mins (sleep) before moving to next app server.
The logic is working fine but the sleeps is applied even after the 2nd (last) app server, which is adding additional 2 minutes.
Is there a way to find that I have reached the last value in the list? so that I can exit without waiting.
sl.app.server.list=lstrdrasv01.str.staples.com
<foreach list="${sl.app.server.list}" param="sl.app.server" target="Storelocator.app.deploy" parallel="false" inheritall="true"/>
<sshexec host="${sl.app.server}"
username="${sl.app.username}"
password="${sl.as.password}"
trust="true"
output="output"
command="${start}"/>
<echo message="Waiting for Rolling deploy 2 min..."/>
<sleep seconds="120"/>
</target>
The sleep is executed 2 times where my list contains 2 servers, ideally speaking it should sleep only 1 time because there is no more servers after the 2nd server.
build.xml
? It's hard to help you with so little information. – Zoophilous