You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

rexec.html 3.9 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <!--
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. <html>
  16. <head>
  17. <meta http-equiv="Content-Language" content="en-us">
  18. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  19. <title>RExec Task</title>
  20. </head>
  21. <body>
  22. <h2 id="rexec">RExec</h2>
  23. <h3>Description</h3>
  24. <p>Task to automate a remote rexec session. Just like the <code>Telnet</code> task, it uses
  25. nested <code>&lt;read&gt;</code> to indicate strings to wait for, and
  26. <code>&lt;write&gt;</code> tags to specify text to send to the remote
  27. process.</p>
  28. <p><strong>Note</strong>: This task depends on external libraries not included in the Apache Ant
  29. distribution. See <a href="../install.html#librarydependencies">Library Dependencies</a> for more
  30. information.</p>
  31. <p>You can specify the commands you want to execute as nested elements or via the <var>command</var>
  32. attribute, we recommend you use the <var>command</var> attribute. If you use the <var>command</var>
  33. attribute, you must use the <var>username</var> and <var>password</var> attributes as well.</p>
  34. <h3>Parameters</h3>
  35. <table class="attr">
  36. <tr>
  37. <th>Attribute</th>
  38. <th>Values</th>
  39. <th>Required</th>
  40. </tr>
  41. <tr>
  42. <td>userid</td>
  43. <td>the login id to use on the remote server.</td>
  44. <td>No</td>
  45. </tr>
  46. <tr>
  47. <td>password</td>
  48. <td>the login password to use on the remote server.</td>
  49. <td>No</td>
  50. </tr>
  51. <tr>
  52. <td>server</td>
  53. <td>the address of the remote rexec server.</td>
  54. <td>Yes</td>
  55. </tr>
  56. <tr>
  57. <td>command</td>
  58. <td>the command to execute on the remote server.</td>
  59. <td>No</td>
  60. </tr>
  61. <tr>
  62. <td>port</td>
  63. <td>the port number of the remote rexec server.</td>
  64. <td>No; defaults to <q>512</q> in Unix</td>
  65. </tr>
  66. <tr>
  67. <td>timeout</td>
  68. <td>set a default timeout to wait for a response, specified in seconds.</td>
  69. <td>No; default is no timeout</td>
  70. </tr>
  71. </table>
  72. <h3 id="nested">Parameters specified as nested elements</h3>
  73. <p>The input to send to the server, and responses to wait for, are described as nested elements.</p>
  74. <h4>read</h4>
  75. <p>declare (as a text child of this element) a string to wait for. The element supports
  76. the <var>timeout</var> attribute, which overrides any timeout specified for the task as a whole. It
  77. also has a <var>string</var> attribute, which is an alternative to specifying the string as a text
  78. element.</p>
  79. <p><em>It is not necessary to declare a closing <code>&lt;read&gt;</code> element like for
  80. the <code>Telnet</code> task. The connection is not broken until the command has completed and the
  81. input stream (output of the command) is terminated.</em></p>
  82. <h4>write</h4>
  83. <p>describes the text to send to the server. The <var>echo</var> boolean attribute controls whether
  84. the string is echoed to the local log; this is <q>true</q> by default.</p>
  85. <h3>Example</h3>
  86. <p>A simple example of connecting to a server and running a command.</p>
  87. <pre>&lt;rexec userid=&quot;bob&quot; password=&quot;badpass&quot; server=&quot;localhost&quot; command=&quot;ls&quot;/&gt;</pre>
  88. <p>The task can be used with other ports as well:</p>
  89. <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>
  90. </body>
  91. </html>