Reputation: 1723
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
Upvotes: 0
Views: 2319
Reputation: 29844
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
)
Upvotes: 1
Reputation: 17718
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.
Upvotes: 2