Re: launching background processes using ssh
From: Bill Weiss (houdini_at_nmt.edu)
Date: Wed, 22 Oct 2003 19:55:02 -0600 To: firstname.lastname@example.org
Pascal J.Bourguignon(email@example.com)@Wed, Oct 22, 2003 at 08:56:18PM +0200:
> Samuel Richard writes:
> > I want to use ssh to launch programs on several hosts.
> > The problem is that my programs do not return, and even if I launch them
> > in background, ssh hangs on.
> > Does anybody have any solution?
> Redirect stdin, stdout and stderr:
> ssh remote 'xclock -display :0.0 </dev/null >/dev/null 2>&1 &'
This is ridiculous.
Redirects stdin from /dev/null (actually, prevents reading from stdin).
This must be used when ssh is run in the background. A common trick is to
use this to run X11 programs on a remote machine. For example, ssh -n
shadows.cs.hut.fi emacs & will start an emacs on shadows.cs.hut.fi, and
the X11 connection will be automatically forwarded over an encrypted chan-
nel. The ssh program will be put in the background. (This does not work
if ssh needs to ask for a password or passphrase; see also the -f option.)
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
What would be the problem with using the built in solutions?
-- Bill Weiss There are no problems that cannot be solved by the judicious use of high explosives. -- Unknown