RemoteSshUtil

public class RemoteSshUtil
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.RemoteSshUtil


Utility to execute ssh commands on remote instances.

Summary

Public constructors

RemoteSshUtil()

Public methods

static CommandResult remoteSshCommandExec(String host, String user, File sshPrivateKey, IRunUtil runUtil, long timeoutMs, String... command)

Execute a command on the remote instance using ssh.

static CommandResult remoteSshCommandExec(String host, String user, File sshPrivateKey, IRunUtil runUtil, long timeoutMs, OutputStream stdout, OutputStream stderr, String... command)

Execute a command on the remote instance using ssh.

Public constructors

RemoteSshUtil

public RemoteSshUtil ()

Public methods

remoteSshCommandExec

public static CommandResult remoteSshCommandExec (String host, 
                String user, 
                File sshPrivateKey, 
                IRunUtil runUtil, 
                long timeoutMs, 
                String... command)

Execute a command on the remote instance using ssh.

Parameters
host String

user String

sshPrivateKey File

runUtil IRunUtil: a IRunUtil to execute commands.

timeoutMs long: in millisecond for the fetch to complete

command String: The command to be executed.

Returns
CommandResult A CommandResult containing the status and logs.

remoteSshCommandExec

public static CommandResult remoteSshCommandExec (String host, 
                String user, 
                File sshPrivateKey, 
                IRunUtil runUtil, 
                long timeoutMs, 
                OutputStream stdout, 
                OutputStream stderr, 
                String... command)

Execute a command on the remote instance using ssh.

Parameters
host String

user String

sshPrivateKey File

runUtil IRunUtil: a IRunUtil to execute commands.

timeoutMs long: in millisecond for the fetch to complete

stdout OutputStream: An OutputStream where the stdout will be logged.

stderr OutputStream: An OutputStream where the stderr will be logged.

command String: The command to be executed.

Returns
CommandResult A CommandResult containing the status and logs.