On Sat, 22 Oct 2005 08:34:17 -0700, Dani Camps wrote:
> Hello,
>
> Tipically If you run a remote command using SSH the behavior is the
> following:
>
> #ssh user@remote_machine ls
>
> It runs ls and it sends you the output back, so in your machine you see
> the output of the ls command.
>
> What about if instead of ls I want to execute a daemon and leave the
> daemon running in the remote machine. Then the command line would be
> blocked until the remote daemon terminates in order to drop the output
> in my terminal. But then I have a problem, imagine I want to write an
> script that runs this daemon in two dirfferent machines, I mean sth
> like:
>
> #!/bin/bash
>
> ssh user@machine_1 daemon
> ssh user@machine_2 daemon
>
> The problem with this is that after the first ssh the execution stops
> until daemon terminates in machine_1. But this is not what I want, I
> want this script to execute daemon in machine_1 then in machine_2 and
> exits leaving the daemons running in both machines.
>
> I have tried running the daemons in background (&) but it does nor
> work, ssh waits for the output anyway.
>
> Best Regards
>
> Dani
From ssh man page:
-f Requests ssh to go to background just before command execution.
This is useful if ssh is going to ask for passwords or
passphrases, but the user wants it in the background. This
implies -n. The recommended way to start X11 programs at a
remote site is with something like ssh -f host xterm.
Is that what you want?
|