RemoteSshUtil

public class RemoteSshUtil
extends Object

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


用于在远程实例上执行 SSH 命令的实用程序。

摘要

公共构造函数

RemoteSshUtil()

公共方法

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

使用 SSH 在远程实例上执行命令。

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

使用 SSH 在远程实例上执行命令。

公共构造函数

RemoteSshUtil

public RemoteSshUtil ()

公共方法

remoteSshCommandExec

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

使用 SSH 在远程实例上执行命令。

参数
host String

user String

sshPrivateKey File

runUtil IRunUtil:用于执行命令的 IRunUtil

timeoutMs long:以毫秒为单位,表示提取完成的时间

command String:要执行的命令。

返回
CommandResult 包含状态和日志的 CommandResult

remoteSshCommandExec

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

使用 SSH 在远程实例上执行命令。

参数
host String

user String

sshPrivateKey File

runUtil IRunUtil:用于执行命令的 IRunUtil

timeoutMs long:以毫秒为单位,表示提取完成的时间

stdout OutputStream:用于记录 stdout 的 OutputStream

stderr OutputStream:用于记录 stderr 的 OutputStream

command String:要执行的命令。

返回
CommandResult 包含状态和日志的 CommandResult