Bob Proulx wrote:
NOT this:

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

But this:

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

OH!  I see now... yea, that would require active participation.

  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.

Trapping the signals in the shell does not trap them in the exec'd child program, so I don't see how this would work.



_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to