|
From: | Phillip Susi |
Subject: | Re: nohup feature request / Please fwd to Jim Meyering |
Date: | Thu, 14 Jun 2007 13:34:54 -0400 |
User-agent: | Thunderbird 1.5.0.12 (Windows/20070509) |
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.
[Prev in Thread] | Current Thread | [Next in Thread] |