examples

Class RemoteShellScript

    • Constructor Summary

      Constructors 
      Constructor and Description
      RemoteShellScript(SSH2ConsoleRemote console)
      Constructor which takes the remote console where the script should be executed as argument.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void closed(ExpectOutputStream out, byte[] buf, int len)
      This function is called when the data stream is closed.
      void exit()
      Log off from server
      static void main(java.lang.String[] argv)
      Run the application
      void reached(ExpectOutputStream out, byte[] buf, int len)
      This function is called whenever the expected string is found in the data stream.
      java.lang.String run(java.lang.String cmd)
      Launch a single command on the server
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RemoteShellScript

        public RemoteShellScript(SSH2ConsoleRemote console)
        Constructor which takes the remote console where the script should be executed as argument.
        Parameters:
        console - connection to server
    • Method Detail

      • run

        public java.lang.String run(java.lang.String cmd)
        Launch a single command on the server
        Parameters:
        cmd - command line to execute
        Returns:
        the output from the given command
      • exit

        public void exit()
        Log off from server
      • main

        public static void main(java.lang.String[] argv)
        Run the application
      • reached

        public void reached(ExpectOutputStream out,
                   byte[] buf,
                   int len)
        Description copied from interface: ExpectOutputStream.Expector
        This function is called whenever the expected string is found in the data stream.
        Specified by:
        reached in interface ExpectOutputStream.Expector
        Parameters:
        out - the stream this happened on.
        buf - a buffer containing all the data which has been seen on the stream since the last time reached was called. Note that the buffer may be bigger than needed.
        len - how many bytes of data there is in the buffer.
      • closed

        public void closed(ExpectOutputStream out,
                  byte[] buf,
                  int len)
        Description copied from interface: ExpectOutputStream.Expector
        This function is called when the data stream is closed.
        Specified by:
        closed in interface ExpectOutputStream.Expector
        Parameters:
        out - the stream this happened on.
        buf - a buffer containing all the data which has been seen on the stream since the last time reached was called. Note that the buffer may be bigger than needed.
        len - how many bytes of data there is in the buffer.