public class SshSupport
extends java.lang.Object
Constructor and Description |
---|
SshSupport() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
runSshCommand(URIish sshUri,
CredentialsProvider provider,
FS fs,
java.lang.String command,
int timeout)
Utility to execute a remote SSH command and read the first line of
output.
|
public static java.lang.String runSshCommand(URIish sshUri, @Nullable CredentialsProvider provider, FS fs, java.lang.String command, int timeout) throws java.io.IOException, CommandFailedException
sshUri
- the SSH remote URIprovider
- the CredentialsProvider
or null
.fs
- the FS
implementation passed to
SshSessionFactory
command
- the remote command to execute.timeout
- a timeout in seconds. The timeout may be exceeded in corner
cases.java.io.IOException
CommandFailedException
- if the ssh command execution failed, error message contains
the content of stderr.