public class SSHConnection extends Object
| 构造器和说明 |
|---|
SSHConnection(ch.ethz.ssh2.Connection conn) |
| 限定符和类型 | 方法和说明 |
|---|---|
Result |
addUser(String userName,
String password)
添加用户
|
YesOrNo |
checkDocker()
是否支持docker
|
void |
close() |
ch.ethz.ssh2.SCPClient |
createSCPClient() |
List<DockContainer> |
dockerps(String... greps)
得到docker容器
|
Result |
executeCommand(CommandCentOs cmd,
String grepStr,
Object... params) |
Result |
executeCommand(ch.ethz.ssh2.Session session,
String cmd,
int timoutMillis,
ILineProcessor lineProcessor) |
Result |
executeCommand(String cmd)
执行命令并返回结果,可以执行多次
|
Result |
executeCommand(String cmd,
ILineProcessor lineProcessor) |
Result |
executeCommand(String cmd,
ILineProcessor lineProcessor,
int timoutMillis,
boolean needroot)
执行命令并返回结果,可以执行多次
|
Result |
executeCommand(String cmd,
int timoutMillis) |
MemoryInfo |
freeM() |
ch.ethz.ssh2.Connection |
getConn() |
boolean |
isConnClose() |
boolean |
isSessionClose(ch.ethz.ssh2.Session session) |
Map<Integer,String> |
jps(String... greps)
得到进程信息 key: procId value: 除procId的其它信息
|
Result |
kill(JvmStatus jvmStatus,
int procId) |
Result |
killDocker(String containerId) |
List<FileBean> |
llFile(String parentDir,
YesOrNo isFile) |
ch.ethz.ssh2.Session |
openSession() |
Result |
scp(String[] localFiles,
String[] remoteFiles,
String remoteTargetDirectory,
String mode) |
Result |
scp(String localFile,
String remoteFileName,
String remoteTargetDirectory,
String mode)
Copy a set of local files to a remote directory, uses the specified mode when
creating the file on the remote side.
|
Result |
scpToDir(String localFile,
String remoteTargetDirectory) |
Result |
scpToDir(String localFile,
String remoteTargetDirectory,
String mode) |
Result |
scpToFile(String localFile,
String remoteFile,
String remoteTargetDirectory) |
Result |
scpToFile(String localFile,
String remoteFile,
String remoteTargetDirectory,
String mode) |
Result |
tarX(String filePath) |
Result |
tarX(String filePath,
String toDirPath) |
public ch.ethz.ssh2.Connection getConn()
public ch.ethz.ssh2.Session openSession()
throws ProjectException
ProjectExceptionpublic ch.ethz.ssh2.SCPClient createSCPClient()
throws ProjectException
ProjectExceptionpublic void close()
public boolean isConnClose()
public Map<Integer,String> jps(String... greps)
greps - public List<DockContainer> dockerps(String... greps)
greps - public MemoryInfo freeM()
public boolean isSessionClose(ch.ethz.ssh2.Session session)
public Result executeCommand(String cmd)
cmd - public Result executeCommand(CommandCentOs cmd, String grepStr, Object... params)
public Result addUser(String userName, String password)
userName - 用户名password - 密码public YesOrNo checkDocker()
public Result executeCommand(String cmd, ILineProcessor lineProcessor)
public Result executeCommand(String cmd, ILineProcessor lineProcessor, int timoutMillis, boolean needroot)
cmd - lineProcessor - 回调处理行public Result executeCommand(ch.ethz.ssh2.Session session, String cmd, int timoutMillis, ILineProcessor lineProcessor) throws ProjectException
ProjectExceptionpublic Result scp(String[] localFiles, String[] remoteFiles, String remoteTargetDirectory, String mode)
public Result scp(String localFile, String remoteFileName, String remoteTargetDirectory, String mode)
localFile - remoteTargetDirectory - mode - public Result scpToFile(String localFile, String remoteFile, String remoteTargetDirectory)
Copyright © 2018. All rights reserved.