|
|
@@ -293,20 +293,19 @@ public class Sftp {
|
|
|
public Result deployMgrNode(String localDir, String remoteDir, RemoteHost remoteHost) {
|
|
|
Result result = Result.success();
|
|
|
try {
|
|
|
- FileUtils.copyFileToDirectory(new File(localDir), new File(remoteDir));
|
|
|
+ FileUtils.copyDirectory(new File(localDir), new File(remoteDir));
|
|
|
log.info("copy files from {} to {} done...", localDir, remoteDir);
|
|
|
|
|
|
- String command = String.format("cd %s && %s shutdown.sh && %s start.sh", remoteDir, bash, bash);
|
|
|
- ShellResult shellResult = shellExecutor.exec(command.split("\\s+"));
|
|
|
- int exitCode = shellResult.getExitCode();
|
|
|
+ String command1 = String.format("%s restart.sh", bash);
|
|
|
+ ShellResult shellResult = shellExecutor.execWithDir(remoteDir, command1.split("\\s+"));
|
|
|
if (!shellResult.isSuccess()) {
|
|
|
- String errMsg = String.format("start application failed\nexitCode: %s\nresult:\n%s", shellResult.getExitCode(), shellResult.getResult());
|
|
|
+ String errMsg = String.format("restart application failed\nexitCode: %s\nresult:\n%s", shellResult.getExitCode(), shellResult.getResult());
|
|
|
log.error(errMsg);
|
|
|
result = Result.fail(errMsg);
|
|
|
} else {
|
|
|
- log.info("start application successfully");
|
|
|
+ log.info("restart application successfully");
|
|
|
}
|
|
|
- } catch (IOException e) {
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|