Package com.sun.faban.common

Examples of com.sun.faban.common.Command


            }
            if (pid <= 0) {
                continue;
            }
            // Now kill the server
            Command cmd = new Command("kill " + pid);
            try {
                RunContext.exec(hostName, cmd);
                // Check if the server truly stopped
                if (!checkServerStopped(hostName))
                        logger.severe("Cannot kill nginx pid " + pid + " on " + hostName);
View Full Code Here


       
        try
        {
            logger.info("starting DFS");
            Command bench = new Command(hadoopBinPath + "start-dfs.sh");
            bench.setStreamHandling(Command.STDERR, Command.TRICKLE_LOG);
            //ctx.exec(bench);
            RunContext.exec(bench);

            logger.info("starting MAPRED");
            bench = new Command(hadoopBinPath + "start-mapred.sh");
            bench.setStreamHandling(Command.STDERR, Command.TRICKLE_LOG);
            //ctx.exec(bench);
            RunContext.exec(bench);
            logger.info("startupHadoopService done");

        }catch(InterruptedException ie)
View Full Code Here

    {
        try
        {
            logger.info("shutdownHadoopService starting");
            logger.info("Stopping RIG if it is running");
            Command bench = new Command(hadoopBinPath + "stop-all.sh");
            bench.setStreamHandling(Command.STDERR, Command.TRICKLE_LOG);
            //ctx.exec(bench);
            RunContext.exec(bench);
            logger.info("shutdownHadoopService done");
           
        }catch(InterruptedException ie)
View Full Code Here

                            " -classpath " + clientJar + " specwebclient ";
            if (hostPort.value != null)
                cmd += " -p " +  hostPort.value;

            logger.info("Starting the client on " + hostPort.name + ": " + cmd);
            Command client = new Command(cmd);
            client.setSynchronous(false);
            client.setOutputFile(Command.STDOUT, out);
            client.setOutputFile(Command.STDERR, errors);
            // Using capture will enable logging to the files, in 8K chunks.
            client.setStreamHandling(Command.STDOUT, Command.CAPTURE);
            client.setStreamHandling(Command.STDERR, Command.CAPTURE);
            // client.setWorkingDirectory("/export/home/w2005");

            exec(hostPort.name, client);
        }
    }
View Full Code Here

        classpath.append(clientJar);

        String cmd = "java -server -Xmx800m -Xms800m -classpath " +
                     classpath + "  specweb";
        logger.info("Starting the Master: " + cmd);
        Command c = new Command(cmd);

        // 2. Trickle the log.
        c.setSynchronous(false);
        c.setOutputFile(Command.STDOUT, "result.txt");
        // Using trickle will enable the Server to see the data
        c.setStreamHandling(Command.STDOUT, Command.TRICKLE_LOG);
        c.setStreamHandling(Command.STDERR, Command.TRICKLE_LOG);
        c.setWorkingDirectory(runDir);

        startTime = Calendar.getInstance();
        handle = exec(c);
    }
View Full Code Here

     * Starts up the Oracle instances.
     */
    @Start public void startup() {
        for (int i = 0; i < myServers.length; i++) {
            logger.fine("Starting oracle on " + myServers[i]);
            Command startCmd = new Command(oracleStartCmd);
            startCmd.setEnvironment(env);
            logger.fine("Starting oracle with: " + oracleStartCmd);
            startCmd.setSynchronous(false); // to run in bg
            try {
                // Run the command in the background
                if ( !checkServerStarted(i)) {
                    serverHandles[i] = RunContext.exec(myServers[i], startCmd);
                    logger.fine("Completed Oracle server startup " +
                            "successfully on" + myServers[i]);
                }
            } catch (Exception e) {
                logger.log(Level.WARNING, "Failed to start Oracle server.", e);
            }
            if(ctx.getProperty("includes").equalsIgnoreCase("true")) {
                logger.fine("Starting listner");
                Command listerCmd = new Command(oracleBin + "lsnrctl start");
                listerCmd.setSynchronous(false); // to run in bg
                try {
                    // Run the command in the background
                    if (!checkListnerStarted(myServers[i])) {
                        RunContext.exec(myServers[i], listerCmd);
                        logger.fine("Completed listner startup successfully on"
View Full Code Here

        return started;
    }

    private boolean checkListnerStarted(String hostName) throws Exception {
        boolean started = false;
        CommandHandle ch = RunContext.exec(hostName, new Command(oracleBin + "lsnrctl status"));
        if (ch.fetchOutput(0) != null){
            started = true;
        }
        return started;
    }
View Full Code Here

    private void stopServer(String serverId){
        logger.fine("Stopping Oracle server on" + serverId);
        try {
            // First kill oracle
            Command stopCmd = new Command(oracleStopCmd);
            RunContext.exec(serverId, stopCmd);
            logger.fine("Oracle server stopped successfully on" + serverId);
        } catch (Exception ie) {
            logger.warning("Kill Oracle failed with " + ie.toString());
            logger.log(Level.FINE, "kill Oracle Exception", ie);
View Full Code Here

    }

    private void stopListner(String serverId){
        logger.fine("Stopping listner on" + serverId);
        try {
            Command stopCmd = new Command(oracleBin + "lsnrctl stop");
            RunContext.exec(serverId, stopCmd);
            logger.fine("Listner stopped successfully on" + serverId);
        } catch (Exception ie) {
            logger.warning("Kill listner failed with " + ie.toString());
            logger.log(Level.FINE, "kill listner Exception", ie);
View Full Code Here

         {                                                                
             logger.warning("The external job to be executed is: "+otherHadoopJob);
             logger.info("starting Foreign Job");
             startTime = Calendar.getInstance();            

             Command bench = new Command(hadoopHome +File.separator+ "bin" +File.separator+ "hadoop "+otherHadoopJob);
             bench.setOutputFile(Command.STDOUT, runDir + "/hadoop.output");
             bench.setOutputFile(Command.STDERR, runDir + "/hadoop.err");
             bench.setSynchronous(false);
             bench.setWorkingDirectory(runDir);
             benchHandle = RunContext.exec(bench);
            
         }else if(benchmarkName.compareTo("JavaSort-Medium") == 0)        
         {
             startTime = Calendar.getInstance();            

             logger.info("start java Sorting");
             Command bench = new Command(gridmixHome + File.separator + "javasort" + File.separator + "text-sort.medium");
             bench.setOutputFile(Command.STDOUT, runDir + "/hadoop.output");
             bench.setOutputFile(Command.STDERR, runDir + "/hadoop.err");            
             bench.setSynchronous(false);            
             bench.setWorkingDirectory(runDir);
             benchHandle = RunContext.exec(bench);
         }else        
         {
            logger.warning("Hadoop not starting.");           
        
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.