tags:

views:

18

answers:

2

I am using plink to execute a command to remote server through openSSH, The command gets successfully executed on the remote 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

+2  A: 

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.

Yuliy
How to kill it programatically.
java.lang.Runtime.exec("taskkill /f /im plink.exe") should do the trick
Yuliy
+1  A: 

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)

Axeman