Package io.fathom.auto.processes

Examples of io.fathom.auto.processes.ProcessExecution


    public static boolean validate(File configFile) throws IOException {
        log.info("Doing haproxy validate");

        ProcessBuilder pb = new ProcessBuilder(HAPROXY_CMD.getAbsolutePath(), "-c", "-f", configFile.getAbsolutePath());

        ProcessExecution execution = Processes.run(pb, TimeSpan.seconds(10));
        if (!execution.didExit()) {
            log.warn("Timeout while validating haproxy config.");
        } else {
            int exitCode = execution.getExitCode();
            if (exitCode == 0) {
                log.info("Validated config file");
                return true;
            } else {
                log.warn("Error validating haproxy config.  Exit code {}", exitCode);

                String config = Files.toString(configFile, Charsets.UTF_8);
                log.warn("Bad haproxy config: {}", config);
            }
        }

        log.warn("stdout: {}", execution.getStdout());
        log.warn("stderr: {}", execution.getStderr());

        return false;
    }
View Full Code Here


            log.info("SSH key not found; calling keygen helper script");

            ProcessBuilder pb = new ProcessBuilder("/opt/manager/keygen.sh");

            // We allow (a very generous) 2 minutes. SSH keygen isn't trivial...
            ProcessExecution execution = Processes.run(pb, TimeSpan.minutes(2));

            if (!execution.didExit()) {
                throw new IOException("Timeout while starting Process");
            } else {
                if (execution.getExitCode() == 0) {
                    log.info("Process started OK");
                }
            }
        }
    }
View Full Code Here

        configureInstance(config);

        ProcessBuilder pb = buildLauncherProcess(config);

        ProcessExecution execution = Processes.run(pb, TimeSpan.minutes(1));

        if (!execution.didExit()) {
            throw new IOException("Timeout while starting Process");
        } else {
            if (execution.getExitCode() == 0) {
                log.info("Process started OK");

                // TODO: Poll loop with timeout?
                TimeSpan.seconds(2).sleep();
View Full Code Here

        configureInstance(config);

        ProcessBuilder pb = buildLauncherProcess(config);

        ProcessExecution execution = Processes.run(pb, TimeSpan.minutes(1));

        if (!execution.didExit()) {
            throw new IOException("Timeout while starting Process");
        } else {
            if (execution.getExitCode() == 0) {
                log.info("Process started OK");

                // TODO: Poll loop with timeout?
                TimeSpan.seconds(2).sleep();
View Full Code Here

        args.add(config.getConfigFile().getAbsolutePath());

        ProcessBuilder pb = new ProcessBuilder(args);
        pb.directory(instanceDir);

        ProcessExecution execution = Processes.run(pb, TimeSpan.minutes(1));

        if (!execution.didExit()) {
            throw new IOException("Timeout while starting zookeeper");
        } else {
            if (execution.getExitCode() == 0) {
                log.info("Zookeeper started OK");

                File pidFile = getPidFile(instanceDir);
                Pid pid = Pid.read(pidFile);
                if (pid == null) {
View Full Code Here

TOP

Related Classes of io.fathom.auto.processes.ProcessExecution

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.