开发者

sending SIGINT CTRL-C using ganymed SSH2?

I need to kill a process that I have started using ganymed SSH2. Specifically I would like to gracefully kill it using Ctrl+C. I have seen ideas of trying to send ASCII \x03 but 开发者_运维百科when using the execCommand() it wont take escaped chars. How can I send Ctrl+C SIGINT through ganymed?

If there is another Java SSH app I should be using let me know, I have looked into Jsch, sshj but just found ganymed ssh2 to the be easiest.

The program i am trying to kill is tethereal (wireshark)


I've used this with JSch to successfully send Ctrl+C:

JSch jsch = new JSch();
Session session = jsch.getSession(user, host);
session.setPassword(password);
session.connect(timeout);
Channel channel = session.openChannel("shell");
channel.connect();
OutputStream out = channel.getOutputStream();
...
out.write(3); // send CTRL-C
out.flush();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜