Package com.sun.faban.common

Examples of com.sun.faban.common.CommandHandle


        }
        catch (RemoteException re) {
        }
        try {
            Command c = new Command("/bin/chmod", "a+x", ORACLE_SCRIPT);
            CommandHandle h = cmdAgent.execute(c, null);
            int exitValue = h.exitValue();
            if (exitValue != 0) {
                logger.severe("Could not change mode for "+ ORACLE_SCRIPT +
                        ". Exit value for chmod is " + exitValue);
            }
        }
        catch (Exception e) {
            logger.severe("Could not change mode of " + ORACLE_SCRIPT  + " : " +
                    e.toString());
        }

        logger.fine("Executing command " + sqlCmd);

        Command c = new Command(ORACLE_SCRIPT);
        CommandHandle h = cmdAgent.execute(c, null);
        int exitValue = h.exitValue();
        boolean retVal;
        if (exitValue == 0) {
            logger.fine("Command executed successfully");
            retVal = true;
        } else {
View Full Code Here


            logger.log(Level.FINE, "RemoteException", re);
        }

        try {
            Command c = new Command("/bin/chmod", "a+x", ORACLE_SCRIPT);
            CommandHandle h = cmdAgent.execute(c, null);
            int exitValue = h.exitValue();
            if (exitValue != 0) {
                logger.severe("Could not change mode for "+ ORACLE_SCRIPT +
                        ". Exit value for chmod is " + exitValue);
            }
        }
        catch (Exception e) {
            logger.severe("Could not change mode of " + ORACLE_SCRIPT + " : " + e);
            logger.log(Level.FINE, "Exception", e);
        }

        logger.fine("Executing command " + cmd);

        Command c = new Command(ORACLE_SCRIPT);
        CommandHandle h = cmdAgent.execute(c, null);
        int exitValue = h.exitValue();
        boolean retVal;
        if (exitValue == 0) {
            logger.info("Listener started.");
            retVal = true;
        } else {
View Full Code Here

            logger.severe("Could not write to " + ORACLE_SCRIPT + " " + re);
            logger.log(Level.FINE, "Exception", re);
        }
        try {
            Command c = new Command("/bin/chmod", "a+x", ORACLE_SCRIPT);
            CommandHandle h = cmdAgent.execute(c, null);
            int exitValue = h.exitValue();
            if (exitValue != 0) {
                logger.severe("Could not change mode for "+ ORACLE_SCRIPT +
                        ". Exit value for chmod is " + exitValue);
            }
        }
        catch (Exception e) {
            logger.severe("Could not change mode of " + ORACLE_SCRIPT + " : " + e);
            logger.log(Level.FINE, "Exception", e);
        }

        logger.fine("Executing command " + cmd);

        Command c = new Command(ORACLE_SCRIPT);
        CommandHandle h = cmdAgent.execute(c, null);
        int exitValue = h.exitValue();
        boolean retVal;
        if (exitValue == 0) {
            logger.info("Listener stopped");
            retVal = true;
        } else {
View Full Code Here

   */
    private static boolean checkServerStarted(String hostName) throws Exception {
        Command checkCmd = new Command(asadminCmd, "list-domains");
        // checkCmd.setLogLevel(Command.STDOUT, Level.FINE);
        // checkCmd.setLogLevel(Command.STDERR, Level.FINE);
        CommandHandle handle = exec(hostName, checkCmd);
        byte[] output = handle.fetchOutput(Command.STDOUT);
        if (output != null) {
            String outStr = new String(output);
        if (outStr.indexOf("domain1 running") != -1)
            return true;
        else
View Full Code Here

                Command stopCmd = new Command(asadminCmd, "stop-domain");
                // stopCmd.setLogLevel(Command.STDOUT, Level.FINE);
                // stopCmd.setLogLevel(Command.STDERR, Level.FINE);

                // Run the command in the foreground
                CommandHandle ch = exec(myServers[i], stopCmd);
               
                // Check if the server was even running before stop was issued
                // If not running, asadmin will print that on stdout
                byte[] output = ch.fetchOutput(Command.STDOUT);

                if (output != null) {
                    String outStr = new String(output);
                    if (outStr.indexOf("stopped.") != -1 ||
                            outStr.indexOf("isn't running.") != -1) {
View Full Code Here

   */
    private static Integer checkServerStopped(String hostName) throws Exception {
        Command checkCmd = new Command(asadminCmd, "list-domains");
        // checkCmd.setLogLevel(Command.STDOUT, Level.FINE);
        // checkCmd.setLogLevel(Command.STDERR, Level.FINE);
        CommandHandle handle = exec(hostName, checkCmd);
        byte[] output = handle.fetchOutput(Command.STDOUT);
        if (output != null) {
            String outStr = new String(output);
            if (outStr.indexOf("domain1 not running") != -1)
                return 1;
            else
View Full Code Here

            success = RunContext.isFile(myServer, pidFile);
            if (success) {
                try {
                    // First kill mysqld_safe
                    Command stopCmd = new Command("pkill mysqld_safe");
                    CommandHandle ch = RunContext.exec(myServer, stopCmd);

                    // Get the pid from the pidFile
                    ByteArrayOutputStream bs = new ByteArrayOutputStream(10);
                    RunContext.writeFileToStream(myServer, pidFile, bs);
                    pidString = bs.toString();
View Full Code Here

TOP

Related Classes of com.sun.faban.common.CommandHandle

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.