From owner-freebsd-questions@FreeBSD.ORG Wed Dec 15 22:39:26 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7E32016A4CE for ; Wed, 15 Dec 2004 22:39:26 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.199]) by mx1.FreeBSD.org (Postfix) with ESMTP id BA6FA43D53 for ; Wed, 15 Dec 2004 22:39:25 +0000 (GMT) (envelope-from z49x2vmq@gmail.com) Received: by wproxy.gmail.com with SMTP id 58so287153wri for ; Wed, 15 Dec 2004 14:39:19 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=pxUlWh3cf/OiiCtU4BLapnDNpT4AHzZAYqjSZNMBeM4yOTejruzlILnUYgXJ/3MyLysYojMWNaasbu9FcdBc9Lqt7CviUNwEa541Q/NEd0GllswSG2StVCMaygYB56HgVvx7sHdIByHW+THdaI7Mw8O+AlRz8xXc2gBxUbUuo/k= Received: by 10.54.47.62 with SMTP id u62mr2970318wru; Wed, 15 Dec 2004 14:39:18 -0800 (PST) Received: by 10.54.54.35 with HTTP; Wed, 15 Dec 2004 14:39:18 -0800 (PST) Message-ID: <2ede6f32041215143942e7f0ed@mail.gmail.com> Date: Wed, 15 Dec 2004 17:39:18 -0500 From: Rae Kim To: Nikolas Britton In-Reply-To: <41C093BC.5010306@nbritton.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <2ede6f3204121510332f0c4a52@mail.gmail.com> <41C093BC.5010306@nbritton.org> cc: freebsd-questions@freebsd.org Subject: Re: How can I make a program keep running even after I logout? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Rae Kim List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Dec 2004 22:39:26 -0000 Thank you all guys.. I've tried daemon, nohup and Nicolas' csh method all works fine. On Wed, 15 Dec 2004 13:42:52 -0600, Nikolas Britton wrote: > Hi Rae, I asked this very same question back in ("Job Control") back in > November, first thing to know is that the default for the csh shell is > not to hangup background jobs when you exit the shell. here is all the > meat from that tread: > > ###This is the way I thought up on my own Rae### > $ ssh localhost > Password: **** > Last login: Mon Nov 22 06:13:59 2004 from localhost > Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994 > The Regents of the University of California. All rights reserved. > > FreeBSD 5.3-RELEASE-p1 (SPECTRA) #0: Sat Nov 20 23:30:17 CST 2004 > > Welcome to FreeBSD! > > $ su > Password: **** > spectra# cvsup -g -L 2 /root/ports-supfile > /root/ports-supfile.log& > [1] 71669 > spectra# exit > exit > $ exit > Connection to localhost closed. > $ tail /root/ports-supfile.log > Add delta 1.25 2004.11.21.22.03.48 marcus > Edit ports/x11-toolkits/py-gnome2/Makefile > Add delta 1.78 2004.11.20.17.18.17 kwm > Edit ports/x11-toolkits/py-gnome2/distinfo > Add delta 1.28 2004.11.20.17.18.17 kwm > Edit ports/x11-toolkits/py-gnome2/pkg-plist > Add delta 1.31 2004.11.20.17.18.17 kwm > Updating collection ports-x11-wm/cvs > Shutting down connection to server > Finished successfully > $ exit > ---------------------- > Presumably you've also nohup -ed the background job too....:-) > > anyway have a look at 'screen' to give you virtual terminals that you > drop out of and back into when you want to. > ----------------------- > yes screen will do that, detach first before logout, then re-attach when > you want o get back to that session. Also no need to background the job, > as screen will just keep the job running after detach anyway.. > > ---------------------- > ###This was the one I liked the most Rae### > >From work: > # nohup foobar >& foobar.log & > > Back home: > # tail -f foobar.log > > Ruben > -------------------- > If all you want to do is inspect the output from your command, then > simply use script(1) to save a transcript of the output. script(1) > comes with the system. Use it like this: > > % cd /usr/ports/x11/xorg > % script /tmp/make.out sudo make install > > And /tmp/make.out will contain a transcript of everything that appears > on your screen during the course of doing that job. > > Cheers, > > Matthew > ------------------- > Thanks.... > > # nohup foobar >& foobar.log & > ^^^^ ^^^ > > Why'd you do it like that, how is it diffrent from this way?: > # nohup foobar > foobar.log & > --------------- > His example redirects both stdout and stderr to foobar.log, while yours > only redirect stdout. (Note that ">&" is a csh-specific operator. The > equivalent for a Bourne-shell derivative would be: > nohup foobar > foobar.log 2>&1 & > I.e. redirecting stdout to foobar.log and then redirecting file > descriptor 2 (stderr) to wherever file descriptor 1 (stdout) goes to > (foobar.log in this case.) > > When used with the nohup command I believe the redirection of stderr > is unnecessary since the manpage for nohup(1) says "If standard error is a > terminal, it is directed to the same place as the standard output." >