Examples of execCommand()


Examples of ch.ethz.ssh2.Session.execCommand()

        String response = null;
        if (!conn.isAuthenticationComplete())
            throw new IOException("Authentication failed");

        Session session = conn.openSession();
        session.execCommand(command);
        StreamGobbler stdout = new StreamGobbler(session.getStdout());

        BufferedReader br = new BufferedReader(new InputStreamReader(stdout));

        while (true) {
View Full Code Here

Examples of com.trilead.ssh2.Session.execCommand()

      // TODO the testcommand should be defined by an option
      String checkShellCommand = "echo %ComSpec%";
      logger.debug("Opening new session...");
      objSSHSession = this.getSshConnection().openSession();
      logger.debug("Executing command " + checkShellCommand);
      objSSHSession.execCommand(checkShellCommand);

      logger.debug("output to stdout for remote command: " + checkShellCommand);
      ipsStdOut = new StreamGobbler(objSSHSession.getStdout());
      ipsStdErr = new StreamGobbler(objSSHSession.getStderr());
      BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(ipsStdOut));
View Full Code Here

Examples of com.trilead.ssh2.Session.execCommand()

  }

  private void executeCommand(String command, int logLevel) throws Exception{
    Session session = getSshConnection().openSession();
    try{
      session.execCommand(command);
      spooler_log.log(logLevel,"output to stdout for remote command: " + command);
      stdout = new StreamGobbler(this.getSshSession().getStdout());
      stderr = new StreamGobbler(this.getSshSession().getStderr());
      BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(stdout));
View Full Code Here

Examples of com.trilead.ssh2.Session.execCommand()

    try {
      String checkShellCommand = "echo %ComSpec%";
      getLogger().debug9("Opening ssh session...");
      session = this.getSshConnection().openSession();
      getLogger().debug9("Executing command " + checkShellCommand);
      session.execCommand(checkShellCommand);

      getLogger().debug9("output to stdout for remote command: " + checkShellCommand);
      stdout = new StreamGobbler(session.getStdout());
      stderr = new StreamGobbler(session.getStderr());
      BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(stdout));
View Full Code Here

Examples of com.trilead.ssh2.Session.execCommand()

    String command = ToolBox.createCommandString(commands);
    SSHDataHandler dataHandler = getHandler();
    Session sess = dataHandler.createSession();
    if (sess == null)
      throw new IOException("Session corrupt");
    sess.execCommand(command);
    return sess;
  }

  private void outputSession(Session sess) throws IOException {
    InputStream stdout = sess.getStdout();
View Full Code Here

Examples of com.trilead.ssh2.Session.execCommand()

      OutputStream outStream, boolean interactive, OutputStream helperStream) throws IOException {
    SSHDataHandler dataHandler = getHandler();
    if (commands.get(0).equals(GromacsConstants.MDRUN)
        && remoteProject.isUseMPILib()) {
      Session mpiSess = dataHandler.createSession();
      mpiSess.execCommand(remoteProject.getMpiLib());
      outputSession(mpiSess);
      // outputStdout(mpiSess.getStdout());
      // outputStdout(mpiSess.getStderr());
      mpiSess.close();
      commands.add(0, Integer.toString(remoteProject.getNp()));
View Full Code Here

Examples of com.trilead.ssh2.Session.execCommand()

    SSHDataHandler dataHandler = getHandler();
    String gromacsCommand = command.substring(0, command.indexOf(" "));
    if (gromacsCommand.equals(GromacsConstants.MDRUN)
        && remoteProject.isUseMPILib()) {
      Session mpiSess = dataHandler.createSession();
      mpiSess.execCommand(remoteProject.getMpiLib());
      outputSession(mpiSess);
      // outputStdout(mpiSess.getStdout());
      // outputStdout(mpiSess.getStderr());
      mpiSess.close();
      String mpiCommand = GromacsConstants.MPIRUN + " "
View Full Code Here

Examples of com.trilead.ssh2.Session.execCommand()

              return false;
            }
           
            Session sess = conn.openSession();
            s_logger.info("Executing : " + commandElement.getTextContent());
            sess.execCommand(commandElement.getTextContent());
            Thread.sleep(60000);
            sess.close();
            conn.close();
           
            } catch (Exception ex) {
View Full Code Here

Examples of com.trilead.ssh2.Session.execCommand()

          }
         
          String restartCommand = "service cloud-management restart; service cloud-usage restart";
          Session sess = conn.openSession();
          s_logger.info("Executing : " + restartCommand);
          sess.execCommand(restartCommand);
          Thread.sleep(120000);
          sess.close();
          conn.close();
         
          } catch (Exception ex) {
View Full Code Here

Examples of com.trilead.ssh2.Session.execCommand()

       
        scp.put("wget.exe", "");
       
        Session sess = conn.openSession();
        s_logger.info("Executing : wget http://172.16.0.220/dump.bin");
        sess.execCommand("wget http://172.16.0.220/dump.bin && dir dump.bin");
       
        InputStream stdout = sess.getStdout();
        InputStream stderr = sess.getStderr();
       
        byte[] buffer = new byte[8192];
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.