|
|
@@ -119,7 +119,7 @@ public class Sftp {
|
|
|
* @return
|
|
|
* @date 2024-02-20 09:20:11
|
|
|
*/
|
|
|
- public boolean mkdir1(Session session, String remotePath) throws SftpException, JSchException {
|
|
|
+ public boolean mkdir(Session session, String remotePath) throws SftpException, JSchException {
|
|
|
boolean exist = true;
|
|
|
// 创建 sftp 通信通道
|
|
|
Channel channel = session.openChannel("sftp");
|
|
|
@@ -149,7 +149,7 @@ public class Sftp {
|
|
|
return exist;
|
|
|
}
|
|
|
|
|
|
- public boolean mkdir(Session session, String remotePath) throws Exception {
|
|
|
+ public boolean mkdir0(Session session, String remotePath) throws Exception {
|
|
|
boolean exist = true;
|
|
|
// 创建 sftp 通信通道
|
|
|
Channel channel = session.openChannel("sftp");
|
|
|
@@ -244,8 +244,9 @@ public class Sftp {
|
|
|
String command = String.format("cd %s && %s shutdown.sh", remoteDir, bash);
|
|
|
ShellResult shellResult = exec(session, command);
|
|
|
if (!shellResult.isSuccess()) {
|
|
|
- log.info("shutdown application failed\nexitCode: {}\nresult:\n{}", shellResult.getExitCode(), shellResult.getResult());
|
|
|
- result = Result.fail("");
|
|
|
+ String errMsg = String.format("shutdown application failed\nexitCode: %s\nresult:\n%s", shellResult.getExitCode(), shellResult.getResult());
|
|
|
+ log.error(errMsg);
|
|
|
+ result = Result.fail(errMsg);
|
|
|
} else {
|
|
|
log.info("shutdown application successfully");
|
|
|
}
|
|
|
@@ -259,8 +260,9 @@ public class Sftp {
|
|
|
String command = String.format("cd %s && %s start.sh", remoteDir, bash);
|
|
|
ShellResult shellResult = exec(session, command);
|
|
|
if (!shellResult.isSuccess()) {
|
|
|
- log.info("start application failed\nexitCode: {}\nresult:\n{}", shellResult.getExitCode(), shellResult.getResult());
|
|
|
- System.exit(-1);
|
|
|
+ String errMsg = String.format("start application failed\nexitCode: %s\nresult:\n%s", shellResult.getExitCode(), shellResult.getResult());
|
|
|
+ log.error(errMsg);
|
|
|
+ result = Result.fail(errMsg);
|
|
|
} else {
|
|
|
log.info("start application successfully");
|
|
|
}
|