Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void startLongRunningCommand(InfrastructureNode infrastructureNode, String command) throws Exception {
- RemoteLongRunningWrapperBean remoteLongRunningWrapperBean = null;
- try {
- remoteLongRunningWrapperBean = stageLongRunningScript(infrastructureNode);
- } catch (IOException ie) {
- log.error("Staging the longRunWrapper script failed!", ie);
- }
- SshCmdOutput sshCmdOutput = null;
- try {
- if (!doesFileExist(infrastructureNode, remoteLongRunningWrapperBean.getFullRemotePath())) {
- log.error("The remote long running script does not exist!");
- throw new IOException();
- } //"nohup echo hi > foo.out 2> foo.err < /dev/null &"
- final String fullCmd = "nohup " + remoteLongRunningWrapperBean.getFullRemotePath() + " \"" + command + "\" > "
- + Long.toString(remoteLongRunningWrapperBean.getIdentifier()) + "-stdout 2> "
- + Long.toString(remoteLongRunningWrapperBean.getIdentifier()) + "-stderr< /dev/null &";
- sshCmdOutput = runSshCommand(infrastructureNode, fullCmd);
- log.info(sshCmdOutput.getStdoutString());
- log.info(sshCmdOutput.getStdoutString());
- } catch (Exception ie) {
- log.error("Unable to run the remote long run wrapper, something is not good here...", ie);
- throw ie;
- }
- }
Add Comment
Please, Sign In to add comment