Re: when does ssh return?



because sleep has the terminal open.

$ time ssh dave@popcorn "nohup sleep 10 &"

or

$ time ssh dave@popcorn "sleep 10 < /dev/null > /dev/null 2>&1 &"

On 5/5/06, David Richardson <dgr24@xxxxxxxxxx> wrote:
I've looked through ssh man page and FAQ and tried a google search, but
can't seem to figure out how to use ssh to start a command on a remote
machine, have ssh exit immediately, and still have the command running
on the remote machine.

When I do

[popcorn][~]$ time ssh dave@popcorn "sleep 10&"

real 0m10.216s
user 0m0.060s
sys 0m0.000s

ssh waits for the sleep to finish. Does anyone either understand why
ssh is waiting for sleep to finish or how to make it not do it?

I've tried

ssh dave@popcorn "run_and_return sleep 10"

where run_and_return is the bash script:

#!/bin/bash
?@&

and a similar thing with a perl script that forks. I even tried having
the perl script fork, have its child fork, and then the grandchild
execute the command.

But ssh keeps sticking around...

Thanks for any help,
Dave

p.s. I'm using

[popcorn][~]$ ssh -V
OpenSSH_3.5p1, SSH protocols 1.5/2.0, OpenSSL 0x0090701f

on

[popcorn][~]$ uname -a
Linux popcorn 2.4.20-6 #1 Thu Feb 27 10:01:19 EST 2003 i686 athlon i386
GNU/Linux

with Fedora Core 2 installed.



--
And, did Guloka think the Ulus were too ugly to save?
-Centauri



Relevant Pages

  • Re: Really need help on this one
    ... Is there a way to read the output of a particular command into ... Heres a better example using ssh. ... set timeout $timeout ... exec kill -9 $pid ...
    (comp.lang.tcl)
  • Re: Terminal command to sleep Mac
    ... you don't know how to use the command line tools that you have at your ... to sleep that way than to go downstairs, put it to sleep with the ... log in via ssh, run shutdown -h now. ...
    (comp.sys.mac.system)
  • Re: OT: Hard disk mirror with Paragon on USB stick?
    ... at least two pages of intricate command line stuff. ... The password is only used when you want to backup to a remote machine ... via the network, using the ssh protocol. ... (e.g. with linux, ...
    (sci.electronics.design)
  • RE: midnight commander and ssh sftp
    ... midnight commander and ssh sftp ... which is displayed at the bottom of the MC panel. ... "Left file command options right" at the top of the MC ... MC SSH session with the remote host by hitting F10 key. ...
    (freebsd-questions)
  • Re: sshd and ftpd
    ... ssh keys, so when you log in it doesn't ask for one. ... we want to be able to connect to our remote host without ... If you used the defaults supplied by the ssh-keygen command, ...
    (Ubuntu)