开发者

issue using plink with java

开发者 https://www.devze.com 2023-01-19 09:00 出处:网络
I am using plink to execute a command to remote server through openSSH, The command gets successfully executed on the re开发者_StackOverflow中文版mote server but on the localhost Task manager still sh

I am using plink to execute a command to remote server through openSSH, The command gets successfully executed on the re开发者_StackOverflow中文版mote server but on the localhost Task manager still shows plink and cmd.exe. How do I terminate these plink and cmd.exe as soon as the command is executed in the server. I am using java in windows.

I am using:

c:\\plink.exe -pw passwd userId@RemoteServerName

Any help is appreciated. Thanks


Just kill the plink process. plink just sets up the tunnel, which your command is then passed over. It's up to you to close the tunnel once you're done with it.


If you're running this from java.lang.Runtime.exec just do a p.destroy() on the Process instance returned by exec. (Here p is an instance of Process)

0

精彩评论

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