bug-coreutils
[Top][All Lists]
Advanced

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

Re: nohup feature request / Please fwd to Jim Meyering


From: Bob Proulx
Subject: Re: nohup feature request / Please fwd to Jim Meyering
Date: Wed, 13 Jun 2007 15:39:32 -0600
User-agent: Mutt/1.5.9i

Phillip Susi wrote:
> Bob Proulx wrote:
> > Jack van de Vossenberg wrote:
> > > My request is: could the output be preceded by
> > > 1) the name/PID of the process that produces the output.
> > > 2) the time that the output was produced.
> >
> > I don't think that is possible without an active participation by a
> > process.
> 
> What requires any kind of active participation?  The only thing 
> requested is that nohup open a file named with the current time and pid 
> instead of /dev/null prior to exec()ing the given command.

Please read the feature request again.  I believe you misunderstood
it.  Your reading of it and my reading of it are completely different.
By the responses from the others I don't think I am alone here.  There
is no request there to open the file with the name/pid encoded in the
file name.  The request is to precede the output with the name/pid of
the process, to precede the output with a timestamp.

NOT this:

  $* >>nohup.out.$name-$pid

But this:

  $* | sed "s/^/$name-$pid: /" >> nohup.out
  $* | sed "s/^/$timestamp: /" >> nohup.out

Although in spirit I know the request was for some way to identify
where the output came from and alternatives would probably be fine.
But just the same that would be different.  If I were asking for one
but got the other I would be completely flabbergasted that the mark
had been missed by that large of an amount.

And let's not forget that the entire original V7 version of nohup was
this next bit.  This is not a snippet.  This is the entire file!

  trap "" 1 15
  if test -t 2>&1  ; then
        echo "Sending output to 'nohup.out'"
        exec nice -5 $* >>nohup.out 2>&1
  else
        exec nice -5 $* 2>&1
  fi

All that nohup does is to ignore SIGHUP and SIGTERM and redirect the
output if it is not already redirected.  Before job control this was
all that was needed to avoid a controlling terminal disconnection from
killing the process.  Unfortunately with job control a little more is
needed.

Bob




reply via email to

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