Using multiple connections

You can use multiple jag_connect commands in a single build file, which allows you to execute jagtool commands for different servers. Each time jag_connect is executed, the current connection or local-mode session is closed and a new one is opened. For example, this code restarts two servers:

<target name="restart_all_servers">
<jag_connect host="host1" password-="jagpass" />
<jag_restart />
<jag_connect host="host2" password="jagpass" />
<jag_restart /></target>

A connection to host1 is opened and the server on host1 is restarted. Then the connection is closed, a connection is opened to host2, and the server on host2 is restarted. The port number for both servers is 9000 and the user name is jagadmin (the defaults). The password for both servers is jagpass, and the log file is System.out.