Need help on how to exit a script run on a server from a remote server

hi,
I am using the below line to run a script from remote server(say server A) to another server(say server B).

ssh username@servername ksh script name.

The issue is the script logs into server B, executes the script on server B, transfers the file to server A but does not exit from Server B
(note that the keys have been generated and added on both the servers for sftp)

My intention is to exit from the server B once the flat file is transferred to A after exeution on B. Kindly help.

What do you mean by "not exiting" , you mean you are not getting the prompt ?

use "exit" at the end of script, Hope this works

Thanks for the info. I had soughted the issue myself :slight_smile:

let us also know the solution. :slight_smile: