I have the following XML structure:
<servers>
<hostname>ABC01</hostname>
<hostname>ABC02</hostname>
</servers>
I need to retrieve a file from each server, from a folder I know, attach it to an email and then send it.
What would be the approach for this?
Thanks.
Use the xmlproperty
task to load an XML file into properties.
Then use the for
task from ant-contrib to act upon each of the matched properties.
Something like:
<target name="funtimes">
<xmlproperty file="the.xml" delimiter=","/>
<for list="${servers.hostname}" param="hostname">
<sequential>
<echo>Doing things with @{hostname}</echo>
</sequential>
</for>
</target>
Fetching files depends upon how you are planning to access them. The scp
task might help.
For sending email you can use the mail
task.