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

Kenneth Loafman kenneth at loafman.com
Tue Jun 5 13:52:49 CDT 2007


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.

...Ken



More information about the Discuss mailing list