Package com.cloud.utils.script

Examples of com.cloud.utils.script.Script.execute()


            return;
        }

        command = new Script("touch", s_logger);
        command.add(extractMountPoint);
        result = command.execute();
        if (result != null) {
            s_logger.warn("Error in creating file " +extractMountPoint+ " ,error: " + result );
            return;
        }
View Full Code Here


        }

        command = new Script("/bin/bash", s_logger);
        command.add("-c");
        command.add("ln -sf " + parentDir + " " +extractMountPoint);
        result = command.execute();
        if (result != null) {
            s_logger.warn("Error in linking  err=" + result );
            return;
        }
View Full Code Here

        //Check whether the Apache server is running
        Script command = new Script("/bin/bash", s_logger);
        command.add("-c");
        command.add("if [ -d /etc/apache2 ] ; then service apache2 status | grep pid; else service httpd status | grep pid; fi ");
        String result = command.execute();

        //Apache Server is not running. Try to start it.
        if (result != null) {            

            /*s_logger.warn("Apache server not running, trying to start it");
View Full Code Here

      }*/     

            command = new Script("/bin/bash", s_logger);
            command.add("-c");
            command.add("if [ -d /etc/apache2 ] ; then service apache2 start; else service httpd start; fi ");
            result = command.execute();
            if (result != null) {
                s_logger.warn("Error in starting httpd service err=" + result );
                return false;
            }
        }
View Full Code Here

  public void run() {
    while (true){
     
      Script myScript = new Script("wget");
      myScript.add(command);
      myScript.execute();
      long begin = System.currentTimeMillis();
      wgetInt process = new wgetInt();
      String response = myScript.execute(process);
      long end = process.getEnd();
      if (response!=null){
View Full Code Here

      Script myScript = new Script("wget");
      myScript.add(command);
      myScript.execute();
      long begin = System.currentTimeMillis();
      wgetInt process = new wgetInt();
      String response = myScript.execute(process);
      long end = process.getEnd();
      if (response!=null){
        s_logger.info("Content lenght is incorrect: "+response);
      }
     
View Full Code Here

        scr.add("-t", downloadPath);
        scr.add("-f", origPath); // this is the temporary
        // template file downloaded
        String result;
        result = scr.execute();

        if (result != null) {
            // script execution failure
            throw new CloudRuntimeException("Failed to run script " + script);
        }
View Full Code Here

            Script command = new Script(this.createTemplateFromSnapshotXenScript, cmd.getWait() * 1000, s_logger);
            command.add("-p", snapshotPath);
            command.add("-s", snapshotName);
            command.add("-n", templateName);
            command.add("-t", destPath);
            String result = command.execute();

            if (result != null && !result.equalsIgnoreCase("")) {
                return new CopyCmdAnswer(result);
            }

View Full Code Here

        command.add("-c");
        command.add("/usr/bin/python /usr/local/cloud/systemvm/scripts/storage/secondary/swift -A " + swift.getUrl()
                + " -U " + swift.getAccount() + ":" + swift.getUserName() + " -K " + swift.getKey() + " download "
                + container + " " + rfilename + " -o " + lFullPath);
        OutputInterpreter.AllLinesParser parser = new OutputInterpreter.AllLinesParser();
        String result = command.execute(parser);
        if (result != null) {
            String errMsg = "swiftDownload failed  err=" + result;
            s_logger.warn(errMsg);
            return errMsg;
        }
View Full Code Here

        command.add("-c");
        command.add("cd " + ldir + ";/usr/bin/python /usr/local/cloud/systemvm/scripts/storage/secondary/swift -A "
                + swift.getUrl() + " -U " + swift.getAccount() + ":" + swift.getUserName() + " -K " + swift.getKey()
                + " download " + container);
        OutputInterpreter.AllLinesParser parser = new OutputInterpreter.AllLinesParser();
        String result = command.execute(parser);
        if (result != null) {
            String errMsg = "swiftDownloadContainer failed  err=" + result;
            s_logger.warn(errMsg);
            return errMsg;
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.