Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Mar 2007 05:31:57 -0800
From:      Jeremy Chadwick <koitsu@FreeBSD.org>
To:        sthomas@nerim.net
Cc:        freebsd-stable@freebsd.org
Subject:   Re: Background process
Message-ID:  <20070308133157.GA96143@icarus.home.lan>
In-Reply-To: <52267.194.69.32.50.1173359004.squirrel@webmail.nerim.net>
References:  <52267.194.69.32.50.1173359004.squirrel@webmail.nerim.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Mar 08, 2007 at 02:03:24PM +0100, sthomas@nerim.net wrote:
> Hello,
> 
> I connect to my freebsd box via ssh using putty from a WindowsXP
> workstation, I want to run a process on the freebsd box, then close my ssh
> session (closing putty) while keeping the process running.
> 
> So I run my process like this : # myprogram &, then I exit the shell.
> 
> But when I do that, I can see with ps that my process go from "TT" "p0" to
> "TT" "p0-" and the application doesn't work anymore. For information, the
> program I want to be able to run via ssh then close the ssh session is the
> moinmoin wiki which is a wiki written in python.
> 
> In man ps I can see that the trailing "-" after "p0" means my process can
> no longer reach the controlling terminal... But what can I do to achieve
> my goal ?

The program you're using obviously needs a tty/pty open for it to
function.  Possibly it's trying to output to stdout or stderr and
cannot due to tty/pty being taken out underneathe it.

Other *IX people here can give you some alternate advice, but I'd
recommend these options:

1) Under sh/bash: myprogram 1>/dev/null 2>&1 &
   (or replace /dev/null with a logfile of your choice)

2) Use dtach (ports/misc/dtach) and detach your program.
   http://dtach.sourceforge.net/

3) Use GNU screen (ports/sysutils/screen) and run your program
   within that.
   http://www.gnu.org/software/screen/

-- 
| Jeremy Chadwick                                 jdc at parodius.com |
| Parodius Networking                        http://www.parodius.com/ |
| UNIX Systems Administrator                   Mountain View, CA, USA |
| Making life hard for others since 1977.               PGP: 4BD6C0CB |




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070308133157.GA96143>