public class DeployHelperConnection extends Object
| 构造器和说明 |
|---|
DeployHelperConnection(DeployHelperServer deployHelperServer) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
closeSession()
关闭ssh连接
|
void |
command(String command)
远程执行命令
|
boolean |
exists(String path)
判断目标path是否存在,可以是文件或者文件夹
|
void |
existsAndCreate(String dir)
判断目标目录是否存在,如果不存在则创建目录
|
void |
openSession()
初始化Session连接
|
void |
shell(List<String> shells,
boolean exit)
执行批量Shell命令
|
void |
shell(String shell)
执行shell
|
void |
shell(String shell,
boolean exit)
执行shell命令
|
void |
upload(String sourceFile,
String targetFile)
上传文件
|
public DeployHelperConnection(DeployHelperServer deployHelperServer)
public void openSession()
throws com.jcraft.jsch.JSchException
com.jcraft.jsch.JSchException - ssh连接失败异常public void closeSession()
public void command(String command) throws com.jcraft.jsch.JSchException, IOException
command - 命令com.jcraft.jsch.JSchException - 打开ssh时异常IOException - io普通异常public boolean exists(String path) throws com.jcraft.jsch.JSchException
path - 目录或文件com.jcraft.jsch.JSchException - 打开ssh时异常public void existsAndCreate(String dir) throws com.jcraft.jsch.JSchException
dir - 检查目录com.jcraft.jsch.JSchException - 打开ssh时异常public void shell(String shell) throws com.jcraft.jsch.JSchException, IOException
shell - shell执行命令com.jcraft.jsch.JSchException - 打开ssh时异常IOException - io普通异常public void shell(List<String> shells, boolean exit) throws com.jcraft.jsch.JSchException, IOException
shells - shell命令集合exit - 是否执行完成shell脚本后退出当前会话,默认falsecom.jcraft.jsch.JSchException - 打开ssh时异常IOException - io普通异常public void shell(String shell, boolean exit) throws com.jcraft.jsch.JSchException, IOException
shell - shell脚本exit - 执行后是否退出标志com.jcraft.jsch.JSchException - 打开ssh时异常IOException - io普通异常Copyright © 2020. All rights reserved.