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