Package com.sun.faban.common

Examples of com.sun.faban.common.Command


        catch (RemoteException re) {
            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");
View Full Code Here


     * @return Whether the listener is running
     * @throws Exception An error occurred in the process
     */
    public boolean checkListenerStatus() throws Exception {

        Command cmd = new Command(oracleHome + "/bin/lsnrctl""status");

        cmdAgent.execute(cmd, null);

        return true;

View Full Code Here

     * Start all glassfish servers on configured hosts.
     * @return boolean true if start succeeded on all machines, else false
     */
    public boolean startServers() {

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

        for (int i = 0; i < myServers.length; i++) {
            String server = myServers[i];
View Full Code Here

    /*
   * Check if Glassfish server is started.
   */
    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) {
View Full Code Here

    public boolean stopServers() {
        boolean success = true;
        for (int i = 0; i < myServers.length; i++) {
            Integer retVal = 0;
            try {
                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);
View Full Code Here

    /*
   * Check if glassfish server is stopped.
   */
    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) {
View Full Code Here

                calendar.add(Calendar.SECOND, (totalRunTime * -1));

                String beginDate = df.format(calendar.getTime());

                Command parseCommand = new Command("truncate_errorlog.sh",
                        beginDate, endDate, outFile);
                exec(parseCommand);

            } catch (Exception e) {

View Full Code Here

     */
    @Start public void startup() {
        for (int i = 0; i < myServers.length; i++) {
            String pidFile = dataDir + myServers[i] + ".pid";
            logger.fine("Starting mysql on " + myServers[i]);
            Command startCmd = new Command(mysqlCmd + "--user=mysql " +
                "--datadir=" + dataDir + " --pid-file=" + pidFile);
            logger.fine("Starting mysql with: " + mysqlCmd);
            startCmd.setWorkingDirectory(dbHome);
            startCmd.setSynchronous(false); // to run in bg
            try {
                // Run the command in the background
                RunContext.exec(myServers[i], startCmd);
                /*
                 * Make sure the server has started.
View Full Code Here

    /**
     * Starts up the Lighttpd servers.
     */
    @Start public void startup() {
        logger.fine("Starting command = "  + lightyCmd);
        Command startCmd = new Command(lightyCmd, "-f", confFile);
        startCmd.setLogLevel(Command.STDOUT, Level.FINE);
        startCmd.setLogLevel(Command.STDERR, Level.FINE);
        startCmd.setSynchronous(false); // to run in bg
        ch = new CommandHandle[myServers.length];
        for (int i = 0; i < myServers.length; i++) {
            String server = myServers[i];
            try {
                // Run the command in the foreground and wait for the start
View Full Code Here

            // First check if server is up
            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();

                    stopCmd = new Command("kill " + pidString);
                    logger.fine("Attempting to kill mysqld pid " + pidString);
                    ch = RunContext.exec(myServer, stopCmd);
                    logger.fine("MySQL server stopped successfully on" + myServer);
                } catch (Exception ie) {
                    logger.warning("Kill mysqld failed with " + ie.toString());
View Full Code Here

TOP

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

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.