[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why bash stops process in background?

From: Bob Proulx
Subject: Re: Why bash stops process in background?
Date: Thu, 25 Aug 2005 08:46:22 -0600
User-agent: Mutt/1.5.9i

Peter Volkov Alexandrovich wrote:
> P.S. I'm not subscribed to the list, so please CC me.

> I need to run ssh in background just to forward ports. But anytime I put
> it into background process state became stoped and this does not allow
> me to send packets through forwarded ports. 'bg' command does not help.

Very likely the ssh program is trying to do I/O.  The kernel will
notice this and stop the process so that you can bring it into the
foreground and interact with it.

This really has nothing to do with bash and is simply the behavior of
BSD style job control as implemented by the kernel.

Try giving ssh the -n option.  Also, you may want to use -N too.  Here
is the ssh man page snippets.

     -N      Do not execute a remote command.  This is useful for just for‐
             warding ports (protocol version 2 only).

     -n      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 channel.  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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]