title: Ant script to check if remote instance of Jboss is running
body: <p>I have an Ant script which is used to deploy my application on two different machines at a time. With the local machine i do not have a problem, but when it comes to the remote machine, I want to check if Jboss is up or not. If it is up then  I want to shut it down but if it is not then nothing should be done. I tried to do this by keeping the attribute of <code>&lt;sshexec&gt;</code> as <code>failonerror="on"</code>. This works well when the Jboss is already down and the shutdown command only gives some errors. But the real problem that i faced was when Jboss was running and when the shutdown command was executed, it did not shutdown properly and gave some error. It is in these situations that I want to stop my build script and let the user know that there is something wrong with Jboss on the other machine and it needs to be looked at.</p>
  
  <p>The target code for stopping the remote Jboss is</p>
  
  <pre><code>&lt;target name="stopRemoteJboss" description="Stops Remote Instance of Jboss"&gt;
          &lt;echo message="Stopping Remote Jboss" /&gt;
          &lt;sshexec trust="true" host="${jboss.remote.host}" username="${jboss.remote.username}" password="${jboss.remote.password}" command="${jboss.remote.home}/bin/shutdown.sh -S" port="${jboss.remote.port}"/&gt;
      &lt;/target&gt;
  </code></pre>