Package org.ndviet.library.ssh
Class SshUtils
- java.lang.Object
-
- org.ndviet.library.ssh.SshUtils
-
public final class SshUtils extends java.lang.ObjectExample utility to use SSH via Apache Mina SSHD- Author:
- Drew Thorstensen
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Stringjoin(java.util.List<java.lang.String> status)static SshResponserunCommand(SshConnection conn, java.lang.String cmd, long timeout)Runs a SSH command against a remote system.
-
-
-
Method Detail
-
runCommand
public static SshResponse runCommand(SshConnection conn, java.lang.String cmd, long timeout) throws SshTimeoutException, java.io.IOException
Runs a SSH command against a remote system.- Parameters:
conn- Defines the connection to the system.cmd- The command to run. Should generally be fully qualified (ex. instead of 'ls -la', use '/bin/ls -la')timeout- The amount of time to wait for the command to run before timing out. This is in seconds. This is used as two separate timeouts, one for login another for command execution.- Returns:
- The
SshResponsecontains the output of a successful command. - Throws:
SshTimeoutException- Raised if the command times out.java.io.IOException- Raised in the event of a general failure (wrong authentication or something of that nature).
-
join
public static java.lang.String join(java.util.List<java.lang.String> status)
-
-