use of com.jcraft.jsch.ChannelShell in project ignite by apache.
the class StartNodeCallableImpl method shell.
/**
* Executes command using {@code shell} channel.
*
* @param ses SSH session.
* @param cmd Command.
* @throws JSchException In case of SSH error.
* @throws IOException If IO error occurs.
* @throws IgniteInterruptedCheckedException If thread was interrupted while waiting.
*/
private void shell(Session ses, String cmd) throws JSchException, IOException, IgniteInterruptedCheckedException {
ChannelShell ch = null;
try {
ch = (ChannelShell) ses.openChannel("shell");
ch.connect();
try (PrintStream out = new PrintStream(ch.getOutputStream(), true)) {
out.println(cmd);
U.sleep(EXECUTE_WAIT_TIME);
}
} finally {
if (ch != null && ch.isConnected())
ch.disconnect();
}
}
use of com.jcraft.jsch.ChannelShell in project KeyBox by skavanagh.
the class SecureShellAction method setPtyType.
@Action(value = "/admin/setPtyType")
public String setPtyType() {
Long sessionId = AuthUtil.getSessionId(servletRequest.getSession());
if (SecureShellAction.getUserSchSessionMap() != null) {
UserSchSessions userSchSessions = SecureShellAction.getUserSchSessionMap().get(sessionId);
if (userSchSessions != null && userSchSessions.getSchSessionMap() != null) {
SchSession schSession = userSchSessions.getSchSessionMap().get(id);
ChannelShell channel = (ChannelShell) schSession.getChannel();
channel.setPtySize((int) Math.floor(userSettings.getPtyWidth() / 7.2981), (int) Math.floor(userSettings.getPtyHeight() / 14.4166), userSettings.getPtyWidth(), userSettings.getPtyHeight());
schSession.setChannel(channel);
}
}
return null;
}
Aggregations