Open li7hai26 opened 4 years ago
我提前创建了 /opt/mq-cloud,卡住了,一致提示我目录已存在,我就把,return result上面三行给注释了 ,当前系统版本Centos8.2
/**
@return */ public Result<?> dirWrite(String ip, String dir){ String destDir = MQ_CLOUD_DIR + dir; String comm = "if [ ! -d \"" +destDir+ "\" ];then mkdir -p " + destDir +";else echo 0;fi"; SSHResult sshResult = null; try { sshResult = sshTemplate.execute(ip, new SSHCallback() { public SSHResult call(SSHSession session) { SSHResult sshResult = session.executeCommand(comm); return sshResult; } }); } catch (SSHException e) { logger.error("isNotUsed, ip:{},dir:{}", ip, destDir, e); return Result.getWebErrorResult(e); } Result<?> result = wrapSSHResult(sshResult);
if(result.isOK() && "0".equals(result.getResult())) { return Result.getResult(Status.DB_ERROR).setMessage("目录已存在"); } return result; }
代码检查的目录是/opt/mqcloud/ns或者/opt/mqcloud/broker-xx,即NameServer或broker的目录,并不是/opt/mqcloud,你注释掉的话就不能创建对应的部署目录了。
/opt/mqcloud
我提前创建了 /opt/mq-cloud,卡住了,一致提示我目录已存在,我就把,return result上面三行给注释了 ,当前系统版本Centos8.2
/**
@return */ public Result<?> dirWrite(String ip, String dir){ String destDir = MQ_CLOUD_DIR + dir; String comm = "if [ ! -d \"" +destDir+ "\" ];then mkdir -p " + destDir +";else echo 0;fi"; SSHResult sshResult = null; try { sshResult = sshTemplate.execute(ip, new SSHCallback() { public SSHResult call(SSHSession session) { SSHResult sshResult = session.executeCommand(comm); return sshResult; } }); } catch (SSHException e) { logger.error("isNotUsed, ip:{},dir:{}", ip, destDir, e); return Result.getWebErrorResult(e); } Result<?> result = wrapSSHResult(sshResult);
if(result.isOK() && "0".equals(result.getResult())) { return Result.getResult(Status.DB_ERROR).setMessage("目录已存在"); } return result; }