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
)
精彩评论