Let's say you need to regularly check to make sure that several web servers are up and running. The little Ant script below shows how to do this. On a side note, it also illustrates Ant 1.6 "if" and "unless" conditionals. Add a top level target to call all of your hosts as dependencies.
The target will connect to a port (8080) and see if it is running. If it is up, then darya.server.available is set to not-null (the value doesn't matter) and everything is OK. If it is not running, then darya.server.available is null and the failure condition is applied. You run it with the command "ant test.darya.all".
This will also email you on target failure, assuming you have mail server running on the host that executes the ant script.
Set it up in a CRON job to run regularly.
<!-- These targets test darya -->
<socket server="darya.myplace.indiana.edu" port="8080"/>
<target name="darya.success" if="darya.server.available" depends="test.darya.ports">
<echo message="Darya server is running"/>
<target name="darya.failure" depends="test.darya.ports" unless="darya.server.available">
<echo message="Darya server is down."/>
subject="Darya server is down">
Darya server is down.
<target name="test.darya.all" depends="darya.failure,darya.success"/>