Exec

Description

Elements to automate a remote SSH session. These elements use additional nested <read> to indicate strings to wait for, and <write> tags to specify text to send.

This is a nested element of the SSH task; each element represents a single command executed within the users session.

Parameters for <exec>

The <exec> element executes a single command on the remote computer.

Attribute

Values

Required

cmd

The command to execute.

Yes

Nested Elements

The commands to send to the server, and responses to wait for, are described as nested elements.

<read>

Declare (as a text child of this element) a string to wait for. . It also has a string attribute, which is an alternative to specifying the string as a text element.

Attribute

Values

Required

timeout

The number of milliseconds before the read operation will timeout. Defaults to 0 (Infinite)

No

echo

Should the input be logged. Default is "true"

No

 

<write>

describes the text to send to the server.

Attribute

Values

Required

newline

Should a newline be appended to the text written to the session. Defaults to "true"

No

echo

Should the output be logged. Default is "true"

No

 

Examples

Executing a command

<exec cmd="ls"/>

Reading and Writing

          <exec cmd="passwd">

<read>password:</read>
<write>oldpass</write>
<read>password:</read>
<write>newpass</write>
<read>password:</read>
<write>newpass</write>
</exec>