Package org.rhq.core.system

Examples of org.rhq.core.system.ProcessExecutionResults


        }
        long start = System.currentTimeMillis();
        File basedir = new File(deploymentOptions.getClusterDir());
        for (Integer nodeId : nodeIds) {
            File nodeDir = new File(basedir, "node" + nodeId);
            ProcessExecutionResults results = startNode(nodeDir);
            if (results.getError() != null) {
                log.warn("An unexpected error occurred while starting the node at " + nodeDir, results.getError());
            } else {
                nodeProcessMap.put(nodeId, results.getProcess());
            }
        }
        long end = System.currentTimeMillis();
        log.info("Started embedded cluster in " + (end - start) + " ms");
    }
View Full Code Here


            startScriptExe.addArguments(Arrays.asList("-p", "cassandra.pid"));
        }

        startScriptExe.setWaitForCompletion(0);

        ProcessExecutionResults results = systemInfo.executeProcess(startScriptExe);
        if (log.isDebugEnabled()) {
            log.debug(startScript + " returned with exit code [" + results.getExitCode() + "]");
        }

        return results;
    }
View Full Code Here

        processExecution.setWorkingDirectory(workingDir);
        processExecution.setWaitForCompletion(waitTime);
        processExecution.setCaptureOutput(capture);
        processExecution.setKillOnTimeout(killOnTimeout);

        ProcessExecutionResults results = systemInfo.executeProcess(processExecution);

        Integer exitCode = results.getExitCode();
        Throwable error = results.getError();
        String output = results.getCapturedOutput();

        if (exitCode != null) {
            out.println(MSG.getMsg(AgentI18NResourceKeys.EXECUTE_EXIT_CODE, exitCode));
        }
View Full Code Here

                //processExecution.setEnvironmentVariables(envvars);
                processExecution.setWorkingDirectory(new File(this.agent.getAgentHomeDirectory()).getParent());
                processExecution.setCaptureOutput(false);
                processExecution.setWaitForCompletion(0);
                showMessage(AgentI18NResourceKeys.UPDATE_THREAD_EXECUTING_UPDATE_PROCESS, processExecution);
                ProcessExecutionResults results = sysInfo.executeProcess(processExecution);
                if (results.getError() != null) {
                    throw results.getError();
                }

                // update has started! if this agent is running in non-daemon mode, kill
                // the input stream so the input thread knows to shutdown now
                try {
View Full Code Here

                ProcessExecution proc = ProcessExecutionUtility.createProcessExecution("/usr/bin/sudo", smartctl.getAbsoluteFile());
                //new ProcessExecution("/usr/bin/sudo"); //smartctl.getAbsolutePath());
                proc.setArguments(new String[]{smartctl.getAbsolutePath(), "-i", driveName});
                proc.setCaptureOutput(true);
                proc.setWaitForCompletion(4000);
                ProcessExecutionResults results = context.getSystemInformation().executeProcess(proc);

                StringReader r = new StringReader(results.getCapturedOutput());
                BufferedReader br = new BufferedReader(r);
                String line = null;
                try {
                    String model = null;
                    Pattern p = Pattern.compile("^SMART support is\\:\\s*Enabled$");
 
View Full Code Here

            proc.setArguments(new String[] { "--attributes", context.getResourceKey() });
        }

        proc.setCaptureOutput(true);
        proc.setWaitForCompletion(4000);
        ProcessExecutionResults results = context.getSystemInformation().executeProcess(proc);

        StringReader r = new StringReader(results.getCapturedOutput());
        BufferedReader br = new BufferedReader(r);
        String line = null;
        try {
            String model = null;
            Pattern p = Pattern.compile("^\\s*\\d*\\s*(\\S*)\\s*\\p{XDigit}*\\s*\\S*\\s*\\S*\\s*\\S*\\s*\\S*\\s*\\S*\\s*\\S*\\s*\\S*\\s*(\\d*).*$");
 
View Full Code Here

        ProcessExecution smolt = new ProcessExecution("/usr/bin/smoltSendProfile");
        smolt.setArguments(new String[]{"-p"});
        smolt.setCaptureOutput(true);
        smolt.setWaitForCompletion(4000);
        ProcessExecutionResults results = this.context.getSystemInformation().executeProcess(smolt);

        StringReader r = new StringReader(results.getCapturedOutput());
        BufferedReader br = new BufferedReader(r);
        String line = null;
        try {
            Pattern p = Pattern.compile("^\\s*([\\w\\s]*)\\:\\s*(.*)$");
            while ((line = br.readLine()) != null) {
View Full Code Here

        StringBuilder netArgs = new StringBuilder();
        netArgs.append("ads leave");
        netArgs.append(SPACE + "-U " + username + "%" + password);

        ProcessExecutionResults netResults = execute(NET_PATH, netArgs.toString());
        String results = netResults.getCapturedOutput();

        result.setSimpleResult(results);

        return result;
    }
View Full Code Here

        netArgs.append("join");
        netArgs.append(SPACE + "-w " + workgroup);
        netArgs.append(SPACE + "-S " + controller);
        netArgs.append(SPACE + "-U " + username + "%" + password);

        ProcessExecutionResults authResults = execute(AUTHCONFIG_PATH, authArgs.toString());
        ProcessExecutionResults netResults = execute(NET_PATH, netArgs.toString());

        String results = authResults.getCapturedOutput() + netResults.getCapturedOutput();

        result.setSimpleResult(results);

        return result;
    }
View Full Code Here

        processExecution.setCaptureOutput(true);
        processExecution.setWaitForCompletion(1000L);
        processExecution.setKillOnTimeout(true);

        ProcessExecutionResults results = sysInfo.executeProcess(processExecution);

        return results;
    }
View Full Code Here

TOP

Related Classes of org.rhq.core.system.ProcessExecutionResults

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.