Connect to Terminal via SSH
Connects to a terminal emulator through SSH.
Command availability: IBM RPA SaaS and IBM RPA on premises
Description
Connects to a terminal emulator using an SSH protocol.
Supported terminal emulators
- SSH-compliant terminals
Script syntax
IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.
terminalSshConnect --name(String) --host(String) --username(String) [--password(String)] [--port(Numeric)] [--timeout(TimeSpan)] [--cursorkeysstate(CursorKeyState)] (Boolean)=value
Input parameters
The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.
Designer mode label | Script mode name | Required | Accepted variable types | Description |
---|---|---|---|---|
Name | name |
Required |
Text |
Name given to the connection. |
Server | host |
Required |
Text |
Terminal server with SSH network protocol used for the connection. |
User Name | username |
Required |
Text |
Username for connecting to Server . |
Password | password |
Optional |
Text |
User password for connection to Server . |
Port | port |
Optional |
Number |
Port number Server available for connection to the terminal. |
Cursor Key State | cursorkeysstate |
Optional |
CursorKeysState |
Defines the mode of the terminal's cursor. See the cursorkeysstate parameter options for details. |
Timeout | timeout |
Optional |
Time Span , Number , Text |
Maximum wait time allowed to connect to the terminal. Remember:If no value is defined for the Timeout parameter, the bot uses the context timeout defined by the Set Timeout (
setTimeout ) command. If that command is not used on the script, the default timeout is 5 seconds.
|
cursorkeysstate
parameter options
This parameter defines the mode to interact with the terminal cursor keys, also known as arrow keys. It accepts both Normal and Application modes, acting as follows:
- Normal: The terminal interprets the input as regular text. The arrow keys might produce scape sequences from
ESC [A
throughESC [D
, which can indicate specific actions instead of printing regular characters. - Application: The terminal interprets special keys differently. Instead of sending escape sequences for interpretation, it sends codes that are application-specific. Typically, sends sequences
ESC OA
throughESC OD
to the terminal application.
Output parameters
Designer mode label | Script mode name | Accepted variable types | Description |
---|---|---|---|
SSH Connection | value | Boolean |
Returns True if the connection was succesfully established; otherwise returns False . |
Example
Connects to the www.example.com
terminal.
defVar --name terminalName --type String
defVar --name serverConnection --type String --value "www.example.com"
defVar --name port --type Numeric --value 23
defVar --name connectionSuccess --type Boolean
terminalSshConnect --name "${terminalName}" --host "${connectionSuccess}" --username UserName --password Password --port ${port} connectionSuccess=value
terminalDisconnect --name "${terminalName}"