예제 #1
0
  public void start() throws JSchException {
    Session _session = getSession();

    try {
      sendRequests();

      Request request = new RequestShell();

      request.request(_session, this);
    } catch (Exception e) {
      if (e instanceof JSchException) {
        throw (JSchException) e;
      }
      if (e instanceof Throwable) {
        throw new JSchException("ChannelShell", (Throwable) e);
      }
      throw new JSchException("ChannelShell");
    }

    if (io.in != null) {
      thread = new Thread(this);
      thread.setName("Shell for " + _session.host);
      if (_session.daemon_thread) {
        thread.setDaemon(_session.daemon_thread);
      }
      thread.start();
    }
  }
예제 #2
0
  public void start() throws JSchException {
    Session _session = getSession();
    try {
      sendRequests();
      Request request = new RequestExec(command);
      request.request(_session, this);
    } catch (Exception e) {
      if (e instanceof JSchException) throw (JSchException) e;
      if (e instanceof Throwable) throw new JSchException("ChannelExec", (Throwable) e);
      throw new JSchException("ChannelExec");
    }

    if (io.in != null) {
      thread = new Thread(this);
      thread.setName("Exec thread " + _session.getHost());
      if (_session.daemon_thread) {
        thread.setDaemon(_session.daemon_thread);
      }
      thread.start();
    }
  }