Re: Tcl catch exec hangs when executing a ssh command with pipe
Robert Heller <heller@deepsoft.com> wrote:
> At Fri, 4 May 2012 11:49:29 +0000 (UTC) Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> wrote:
>> Adriana <adriana.telesca@gmail.com> wrote:
>>> I tried with a shell script that simply launches the command but still
>>> the Tcl application hangs.
>>> From the tcl application, I do:
>>> if { [catch {exec startAgent.sh $user $machine} msg] } {
>>> puts "$msg"
>>> }
>>> where startAgent.sh
>>> #!/bin/bash
>>> user=$1
>>> machine=$2
>>> ssh $user@$machine -2 "nohup myprogram 2>&1 | ./log &"
>> Let me guess: if you start startAgent.sh directly from shell,
>> then it doesn't return you to the shell prompt, either.
>> Perhaps try using option "-x" with ssh, just in case, myprogram
>> idly opens an X11-connection, that might keep ssh waiting.
> Note: ssh *will* read from stdin (if nothing else, it will just gobble all
> input on stdin). I *strongly* suggest that the -n and/or -f options be
> supplied to ssh.
I think, that's not the point.
The OP obviously wants to start a remote command to the remote host's
background, and then have ssh finish immediately (and the ssh-connection
be closed, too).
|