[NTLUG:Discuss] OT: Why does remote command over ssh not return control?

Chris Cox cjcox at acm.org
Tue Jun 5 14:01:41 CDT 2007


Kenneth Loafman wrote:
> Dennis Daupert wrote:
>> Jerome Haltom said:
>>
>>> If the script spawns a background process without disowning it, 
>>> that would do it.
>> This must be the critter that's doing what you suggest, I think:
>>
>> start_task()
>> {
>>     echo "Starting $2"
>>     eval "nohup $1 &"
>> }
>>
>> Is there a command or flag I can add in there to disengage?
> 
> The ssh man page says:
> 
> "The session terminates when the command or shell on the remote machine 
> exits and all X11 and TCP connections have been closed."
> 
> The only way I know to detach a process so ssh will close is to use 
> "screen -d -m $1" (no eval and no ampersand).  This will detach the 
> process from ssh and allow ssh to close.


if the nohup above is the terminating command (the script returns in
other words)... then perhaps you can exec it.

eval "exec nohup $1 &"

Just an idea.  Impossible to tell without seeing and playing with
the whole script.





More information about the Discuss mailing list