<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>RExec Task</title>
</head>

<body>

<h2><a name="rexec">RExec</a></h2>
<h3>Description</h3>
Task to automate a remote rexec session. Just like the Telnet task,
it uses nested <tt>&lt;read&gt;</tt> to indicate strings to wait for, and
<tt>&lt;write&gt;</tt> tags to specify text to send to the remote process.

<p><b>Note:</b> This task depends on external libraries not included in the Ant distribution.
See <a href="../install.html#librarydependencies">Library Dependencies</a> for more information.</p>

<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
  <tr>
    <th>Attribute</th>
    <th>Values</th>
    <th>Required</th>
  </tr>
  <tr>
     <td>userid</td>
     <td>the login id to use on the remote server.</td>
     <td>Yes</td>
  </tr>
  <tr>
     <td>password</td>
     <td>the login password to use on the remote server.</td>
     <td>Yes</td>
  </tr>
  <tr>
     <td>server</td>
     <td>the address of the remote rexec server.</td>
     <td>Yes</td>
  </tr>
  <tr>
     <td>command</td>
     <td>the command to execute on the remote server.</td>
     <td>Yes</td>
  </tr>
  <tr>
     <td>port</td>
     <td>the port number of the remote rexec server. Defaults to port 512 in BSD Unix systems.</td>
     <td>No</td>
  </tr>
  <tr>
     <td>timeout</td>
     <td>set a default timeout to wait for a response. Specified in seconds. Default is no timeout.</td>
     <td>No</td>
  </tr>
</table>
<h3><a name="nested">Nested Elements</a></h3>
The input to send to the server, and responses to wait for, are
described as nested elements.  

<h4>read</h4>

<p>declare (as a text child of this element) a string to wait for.
The element supports the timeout attribute, which overrides any
timeout specified for the task as a whole. It also has a <tt>string</tt>
attribute, which is an alternative to specifying the string as 
a text element.
</p>
<i>It is not necessary to declare a closing &lt;read&gt; element like for the Telnet task. The connection is not broken until the command has completed and
the input stream (output of the command) is terminated.
</i>
<h4>write</h4>

<p>describes the text to send to the server. The <tt>echo</tt> boolean
attribute controls whether the string is echoed to the local log; 
this is "true" by default
</p>
<h3>Example</h3>
A simple example of connecting to a server and running a command.

<blockquote><pre>
&lt;rexec userid=&quot;bob&quot; password=&quot;badpass&quot; server=&quot;localhost&quot; command=&quot;ls&quot;/&gt;
</pre></blockquote>

The task can be used with other ports as well:
<blockquote><pre>
&lt;rexec port=&quot;80&quot; userid=&quot;bob&quot; password=&quot;badpass&quot; server=&quot;localhost&quot; command=&quot;ls&quot;/&gt;
</pre></blockquote>

<hr>
<p align="center">Copyright &copy; 2003 Apache Software Foundation. All rights
Reserved.</p>

</body>
</html>