ssh remote execution

  • Follow


it is mentioned in the manual pages of ssh(1) that

" The session terminates when the command or shell on the remote
machine exits and all X11 and TCP/IP connections have been closed."

I wrote a program which create a sub-process the sub-process will then
start another program remotely on another host. I was able to do that
using the following call after I fork another process

execl("/bin/ssh","ssh","user@host","~/dir/remoteprog",0);

However the process on the local host will not exit because of the way
remote execution is designed in ssh.

Is there a way to get around this and close the session before the
remote program finishes its execution.

Thanks in advance

0
Reply baderA (3) 9/29/2005 4:01:36 AM

Bader wrote:
> it is mentioned in the manual pages of ssh(1) that
> 
> " The session terminates when the command or shell on the remote
> machine exits and all X11 and TCP/IP connections have been closed."
> 
> I wrote a program which create a sub-process the sub-process will then
> start another program remotely on another host. I was able to do that
> using the following call after I fork another process
> 
> execl("/bin/ssh","ssh","user@host","~/dir/remoteprog",0);
> 
> However the process on the local host will not exit because of the way
> remote execution is designed in ssh.
> 
> Is there a way to get around this and close the session before the
> remote program finishes its execution.

You need to put the program you run on the remote box in the 
background.  Redirect stdout, stderr and stdin to/from somewhere other 
than the pseudo-terminal ssh provides, e.g. /dev/null.  You may want to 
call it via nohup(1) as well.

-- ced

> 
> Thanks in advance
> 


-- 
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.
0
Reply Chuck 9/29/2005 1:30:12 PM


1 Replies
277 Views

(page loaded in 0.056 seconds)

Similiar Articles:













7/26/2012 12:00:33 AM


Reply: