com.norbl.util.ssh
Class SshExec

java.lang.Object
  extended by com.norbl.util.ssh.SshExec

public class SshExec
extends java.lang.Object

Methods for remotely executing commands via ssh. It includes a general exec method and a few specialized ones (such as creating an rsa keypair.


Field Summary
protected  ch.ethz.ssh2.Connection connection
           
 
Constructor Summary
SshExec(ch.ethz.ssh2.Connection connection)
           
 
Method Summary
 void closeConnection()
           
 void exec(java.lang.String cmd, long maxWait)
          Blocks until the command has executed or an exception is thrown.
 void execNoRead(java.lang.String cmd)
          Deprecated.  
 java.lang.String execRead(java.lang.String cmd, long maxWait)
          Note that
 boolean fileExists(java.lang.String path, long maxWait)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connection

protected ch.ethz.ssh2.Connection connection
Constructor Detail

SshExec

public SshExec(ch.ethz.ssh2.Connection connection)
        throws java.io.IOException
Throws:
java.io.IOException
Method Detail

execRead

public java.lang.String execRead(java.lang.String cmd,
                                 long maxWait)
                          throws java.io.IOException
Note that

Parameters:
cmd - connection.execCommand() does not return until the exec is complete. If it calls an app that runs forever. it never returns.
Returns:
Throws:
java.io.IOException

execNoRead

public void execNoRead(java.lang.String cmd)
                throws java.io.IOException
Deprecated. 

Parameters:
cmd -
Throws:
java.io.IOException

exec

public void exec(java.lang.String cmd,
                 long maxWait)
          throws java.io.IOException
Blocks until the command has executed or an exception is thrown. This method does not capture stdout or stderr output.

Parameters:
cmd -
maxWait -
Throws:
java.io.IOException

closeConnection

public void closeConnection()

fileExists

public boolean fileExists(java.lang.String path,
                          long maxWait)
                   throws java.io.IOException
Throws:
java.io.IOException