Class SshSupport


  • public class SshSupport
    extends java.lang.Object
    Extra utilities to support usage of SSH.
    Since:
    5.0
    • Constructor Summary

      Constructors 
      Constructor Description
      SshSupport()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static int checkTimeout​(java.lang.String command, int timeout, long since)  
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SshSupport

        public SshSupport()
    • Method Detail

      • runSshCommand

        public static java.lang.String runSshCommand​(URIish sshUri,
                                                     @Nullable
                                                     CredentialsProvider provider,
                                                     FS fs,
                                                     java.lang.String command,
                                                     int timeout)
                                              throws java.io.IOException,
                                                     CommandFailedException
        Utility to execute a remote SSH command and read the first line of output.
        Parameters:
        sshUri - the SSH remote URI
        provider - 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.
        Returns:
        The entire output read from stdout.
        Throws:
        java.io.IOException
        CommandFailedException - if the ssh command execution failed, error message contains the content of stderr.