| | |
| | | } |
| | | // 未从库中查询到,需要生成服务信息保存默认信息到库中 |
| | | DeployApps defaultDeployApps = new DeployApps(); |
| | | defaultDeployApps.setLogPath(PARENTPATH + deployAppsVO.getName().replace("-","_") + LOGPATH); |
| | | defaultDeployApps.setLogPath(PARENTPATH + SEPARATOR + deployAppsVO.getName().replace("-","_") + LOGPATH); |
| | | defaultDeployApps.setServerName(deployAppsVO.getName()); |
| | | defaultDeployApps.setStartCmd(CmdConfigEnum.START_CMD.getValue() + deployAppsVO.getName()); |
| | | defaultDeployApps.setStopCmd(CmdConfigEnum.STOP_CMD.getValue() + deployAppsVO.getName()); |
| | | defaultDeployApps.setRestartCmd(CmdConfigEnum.RESTART_CMD.getValue() + deployAppsVO.getName()); |
| | | defaultDeployApps.setServerPath(PARENTPATH + deployAppsVO.getName().replace("-","_")); |
| | | defaultDeployApps.setServerPath(PARENTPATH + SEPARATOR + deployAppsVO.getName().replace("-","_")); |
| | | int eft = deployAppsMapper.insert(defaultDeployApps); |
| | | if (!SqlHelper.retBool(eft)) { |
| | | throw new ServiceException("生成默认服务信息到库中时失败!"); |
| | |
| | | } |
| | | // 等待命令执行完成 |
| | | int exitCode = process.waitFor(); |
| | | // 读取命令执行的错误输出流 |
| | | BufferedReader errorReader = new BufferedReader(new InputStreamReader(process.getErrorStream())); |
| | | StringBuilder errorOutput = new StringBuilder(); |
| | | String errorLine; |
| | | while ((errorLine = errorReader.readLine()) != null) { |
| | | errorOutput.append(errorLine).append("\n"); |
| | | } |
| | | String errorOutputString = errorOutput.toString(); |
| | | log.info("错误输出:" + errorOutputString); |
| | | log.info("命令执行结果:" + output.toString()+":"+exitCode); |
| | | return output.toString(); |
| | | }catch (IOException | InterruptedException e){ |