Package com.cloud.utils.script

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


        command.add(scriptPath);
        command.add(publicKeyPath);
        command.add(privKeyPath);
        command.add(systemVmIsoPath);

        final String result = command.execute();
        if (result != null) {
            s_logger.warn("Failed to inject generated public key into systemvm iso " + result);
            throw new CloudRuntimeException("Failed to inject generated public key into systemvm iso " + result);
        }
    }
View Full Code Here


            final Script unzip = new Script("unzip", 120000, s_logger);
            unzip.add("-o", "-q"); // overwrite and quiet
            unzip.add(file.getAbsolutePath());
            unzip.add("-d", path);

            final String result = unzip.execute();
            if (result != null) {
                throw new CloudRuntimeException(
                        "Unable to unzip the retrieved file: " + result);
            }
View Full Code Here

            return;
        }
        Script command = new Script("/bin/bash", s_logger);
        command.add("-c");
        command.add("ip route delete " + destIpOrCidr);
        command.execute();
        command = new Script("/bin/bash", s_logger);
        command.add("-c");
        command.add("ip route add " + destIpOrCidr + " via " + localgw);
        String result = command.execute();
        if (result != null) {
View Full Code Here

        command.add("ip route delete " + destIpOrCidr);
        command.execute();
        command = new Script("/bin/bash", s_logger);
        command.add("-c");
        command.add("ip route add " + destIpOrCidr + " via " + localgw);
        String result = command.execute();
        if (result != null) {
            s_logger.warn("Error in configuring route to internal ip err="
                    + result);
        } else {
            s_logger.debug("addRouteToInternalIp: added route to internal ip="
View Full Code Here

            if(packToOva) {
                                                    // Important! we need to sync file system before we can safely use tar to work around a linux kernal bug(or feature)
                            s_logger.info("Sync file system before we package OVA...");

                Script commandSync = new Script(true, "sync", 0, s_logger);
                            commandSync.execute();

                  Script command = new Script(false, "tar", 0, s_logger);
                  command.setWorkDir(exportDir);
                  command.add("-cf", exportName + ".ova");
                  command.add(exportName + ".ovf");    // OVF file should be the first file in OVA archive
View Full Code Here

                  for(String name: fileNames) {
                                command.add((new File(name).getName()));
                            }

                            s_logger.info("Package OVA with commmand: " + command.toString());
                  command.execute();

                  // to be safe, physically test existence of the target OVA file
                  if((new File(exportDir + File.separator + exportName + ".ova")).exists()) {
                      success = true;
                  } else {
View Full Code Here

              }
              try {
                  final long pid = Long.parseLong(pidLine);
                  final Script script = new Script("bash", 120000, s_logger);
                  script.add("-c", "ps -p " + pid);
                  final String result = script.execute();
                  if (result == null) {
                      throw new ConfigurationException("Java process is being started twice.  If this is not true, remove " + pidFile.getAbsolutePath());
                  }
                  if (!pidFile.delete()) {
                      throw new ConfigurationException("Java process is being started twice.  If this is not true, remove " + pidFile.getAbsolutePath());
View Full Code Here

          pidFile.deleteOnExit();
 
          final Script script = new Script("bash", 120000, s_logger);
          script.add("-c", "echo $PPID");
          final OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser();
          script.execute(parser);
 
          final String pid = parser.getLine();
 
          final FileOutputStream strm = new FileOutputStream(pidFile);
          strm.write((pid + "\n").getBytes());
View Full Code Here

       
        if (!cmd.isDefault()) {
          command.add("-z");
        }

        final String result = command.execute();
        return new Answer(cmd, result==null, result);
    }

    protected Answer execute(final CreateIpAliasCommand cmd) {
        String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
View Full Code Here

        command.add(routerIp);
        for (IpAliasTO ipaliasto : ipAliasTOs) {
            args = args + ipaliasto.getAlias_count()+":"+ipaliasto.getRouterip()+":"+ipaliasto.getNetmask()+"-";
        }
        command.add(args);
        final String result = command.execute();
        return new Answer(cmd, result==null, result);
    }

    protected Answer execute(final DeleteIpAliasCommand cmd) {
        final Script command  = new Script(_deleteIpAliasPath, _timeout, s_logger);
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.