Job Control

Erik Trulsson ertr1013 at student.uu.se
Mon Nov 22 08:34:31 PST 2004


On Mon, Nov 22, 2004 at 10:17:01AM -0600, Nikolas Britton wrote:
> Ruben de Groot wrote:
> 
> >On Mon, Nov 22, 2004 at 06:49:15AM -0600, Nikolas Britton typed:
> > 
> >
> >>I've play a bit with screen but I don't think it will work for my 
> >>problem so let me restate it. Lets say I wanted to buildworld, build a 
> >>port, cvsup, portupgrade, etc. but forgot to do it before I left for 
> >>school, work, or wherever so I ssh into my box and do #foobar& etc. and 
> >>then exit, then when I get back home I want to see what happened. I 
> >>guess it just goes to show that there's always a solution to a problem, 
> >>you just have to look at it from another angle (can you thing of any 
> >>other solutions btw?):
> >>   
> >>
> >
> >>From work:
> ># nohup foobar >& foobar.log &
> >
> >Back home:
> ># tail -f foobar.log
> >
> >Ruben
> >
> > 
> >
> 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."


-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013 at student.uu.se


More information about the freebsd-questions mailing list