Run SSH Command
Verb: executeSSH
Available from: <Enterprise>
Runs the SSH command informed on an established connection with the server.
Syntax
executeSSH --client(SSHSession) --command(String) [--timeout(TimeSpan)] (String)=value
Inputs
| Script | Designer | Required | AcceptedTypes | Description |
|---|---|---|---|---|
| --client | SSH Connection | Required | SSH Session | Variable containing the data of the established SSH connection.
The established connection is generated by the SSH Login command. |
| --command | Command | Required | Text | SSH command that should be executed. |
| --timeout | Timeout | Optional | Time Span, Number, Text | Maximum wait time for the commando to run. |
Outputs
| Script | Designer | AcceptedTypes | Description |
|---|---|---|---|
| value | Result | Text | Result of running the command. |
Example
The Run SSH Command command is used to execute the command "Is" within the connection previously established by the SSH Login command. Then, the End SSH Session command ends the connection.
defVar --name sshConnection --type SSHSession
defVar --name sshTunnel --type SSHForwardedPort
defVar --name result --type String
// Initiates the connection with an SSH server and tunneling with the destination server.
startSSH --host "172.16.4.200" --username "User Name" --password password --port 22 --keygen "File with private key" --passphrase "Key Phrase" --timeout 00:00:05 sshConnection=value
openSSHTunnel --client ${sshConnection} --port 80 --boundport 8090 --destination "Local" --host "192.168.0.10" sshTunnel=value
// Execute the command "ls" on the SSH server, to obtain a list of the names of the files in the current directory of the destination server.
executeSSH --client ${sshConnection} --command ls --timeout 00:00:05 result=value
// The connection to an SSH server is demonstrated to send commands to it. All host, port and connection data are for example only, requiring the client services and the SSH server to be installed.