Networking Forums

Networking Forums > Computer Networking > Linux Networking > Remote SSH commands

Reply
Thread Tools Display Modes

Remote SSH commands

 
 
Dani Camps
Guest
Posts: n/a

 
      10-22-2005, 03:34 PM
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

 
Reply With Quote
 
 
 
 
Bit Twister
Guest
Posts: n/a

 
      10-22-2005, 03:36 PM
On 22 Oct 2005 08:34:17 -0700, Dani Camps wrote:
>
> I have tried running the daemons in background (&) but it does nor
> work, ssh waits for the output anyway.


what happens if you nohup whatever &
 
Reply With Quote
 
Allen McIntosh
Guest
Posts: n/a

 
      10-23-2005, 02:42 AM
> I have tried running the daemons in background (&) but it does nor
> work, ssh waits for the output anyway.


Did you try redirecting stdin from /dev/null? This is SOP for rhs, so
it's worth a try.
 
Reply With Quote
 
penguin
Guest
Posts: n/a

 
      10-23-2005, 01:05 PM
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?








 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
shell commands mu91t Linux Networking 3 08-07-2008 12:05 PM
Network Commands. Peter F Windows Networking 2 06-09-2007 07:07 AM
Rmail user groups. Rmail. emacs. spamassassin headers. emacs commands. Rmail commands. whitelist. dsaklad@zurich.csail.mit.edu Linux Networking 0 08-06-2005 11:00 PM
openssh to issue remote commands Jon_P Linux Networking 1 08-06-2005 05:36 AM
using remote commands through a router - can anyone help? flash Windows Networking 0 08-02-2003 10:40 AM



1 2 3 4 5 6 7 8 9 10 11