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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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><a name="rexec">RExec</a></h2>
  23. <h3>Description</h3>
  24. Task to automate a remote rexec session. Just like the Telnet task,
  25. it uses nested <tt>&lt;read&gt;</tt> to indicate strings to wait for, and
  26. <tt>&lt;write&gt;</tt> tags to specify text to send to the remote process.
  27. <p><b>Note:</b> This task depends on external libraries not included in the Ant distribution.
  28. See <a href="../install.html#librarydependencies">Library Dependencies</a> for more information.</p>
  29. <p>You can specify the commands you want to execute as nested elements
  30. or via the command attribute, we recommend you use the command
  31. attribute. If you use the command attribute, you must use the
  32. username and password attributes as well.</p>
  33. <h3>Parameters</h3>
  34. <table border="1" cellpadding="2" cellspacing="0">
  35. <tr>
  36. <th>Attribute</th>
  37. <th>Values</th>
  38. <th>Required</th>
  39. </tr>
  40. <tr>
  41. <td>userid</td>
  42. <td>the login id to use on the remote server.</td>
  43. <td>No</td>
  44. </tr>
  45. <tr>
  46. <td>password</td>
  47. <td>the login password to use on the remote server.</td>
  48. <td>No</td>
  49. </tr>
  50. <tr>
  51. <td>server</td>
  52. <td>the address of the remote rexec server.</td>
  53. <td>Yes</td>
  54. </tr>
  55. <tr>
  56. <td>command</td>
  57. <td>the command to execute on the remote server.</td>
  58. <td>No</td>
  59. </tr>
  60. <tr>
  61. <td>port</td>
  62. <td>the port number of the remote rexec server. Defaults to port 512 in BSD Unix systems.</td>
  63. <td>No</td>
  64. </tr>
  65. <tr>
  66. <td>timeout</td>
  67. <td>set a default timeout to wait for a response. Specified in seconds. Default is no timeout.</td>
  68. <td>No</td>
  69. </tr>
  70. </table>
  71. <h3><a name="nested">Nested Elements</a></h3>
  72. The input to send to the server, and responses to wait for, are
  73. described as nested elements.
  74. <h4>read</h4>
  75. <p>declare (as a text child of this element) a string to wait for.
  76. The element supports the timeout attribute, which overrides any
  77. timeout specified for the task as a whole. It also has a <tt>string</tt>
  78. attribute, which is an alternative to specifying the string as
  79. a text element.
  80. </p>
  81. <i>It is not necessary to declare a closing <code>&lt;read&gt;</code> element like for the Telnet task. The connection is not broken until the command has completed and
  82. the input stream (output of the command) is terminated.
  83. </i>
  84. <h4>write</h4>
  85. <p>describes the text to send to the server. The <tt>echo</tt> boolean
  86. attribute controls whether the string is echoed to the local log;
  87. this is "true" by default
  88. </p>
  89. <h3>Example</h3>
  90. A simple example of connecting to a server and running a command.
  91. <blockquote><pre>
  92. &lt;rexec userid=&quot;bob&quot; password=&quot;badpass&quot; server=&quot;localhost&quot; command=&quot;ls&quot;/&gt;
  93. </pre></blockquote>
  94. The task can be used with other ports as well:
  95. <blockquote><pre>
  96. &lt;rexec port=&quot;80&quot; userid=&quot;bob&quot; password=&quot;badpass&quot; server=&quot;localhost&quot; command=&quot;ls&quot;/&gt;
  97. </pre></blockquote>
  98. </body>
  99. </html>