Module datarush.library
Class RemoteCommandRunner
java.lang.Object
com.pervasive.datarush.operators.io.vectorwise.RemoteCommandRunner
- All Implemented Interfaces:
CommandRunner
Run a command on a remote server using the ssh protocol connecting to a sshd.
Only user name and password authentication is supported.
-
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Close the ssh user sessionvoidOpen a session to a remote ssh at the configured host and port.intrunCommand(List<String> args, InputStream stdIn, OutputStream stdOut, OutputStream stdErr) Submits the given command to the connected session.
-
Method Details
-
getConfig
-
initialize
Open a session to a remote ssh at the configured host and port. The client authenticates with the ssh using the configured user name and password. If authentication fails and network communication errors occur, anIOExceptionis thrown.- Specified by:
initializein interfaceCommandRunner- Throws:
IOException- thrown if authentication fails or networking problems occur
-
runCommand
public int runCommand(List<String> args, InputStream stdIn, OutputStream stdOut, OutputStream stdErr) throws IOException Submits the given command to the connected session. The standard output and standard error are captured in the given output streams. The exit code of the shell command is provided as the return value. All resources for the opened command channel are released before returning. This method can be invoked multiple times as needed on an open client session.- Specified by:
runCommandin interfaceCommandRunner- Parameters:
command- the shell command to executestdOut- standard output of the command is captured herestdErr- standard error of the shell command is captured here- Returns:
- exit code of the shell command
- Throws:
IOException- thrown if any error occur communicating with the remote sshd
-
dispose
Close the ssh user session- Specified by:
disposein interfaceCommandRunner- Throws:
IOException- thrown if any errors occur
-