[Top][All Lists]

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

Re: nohup feature request / Please fwd to Jim Meyering

From: Micah Cowan
Subject: Re: nohup feature request / Please fwd to Jim Meyering
Date: Thu, 14 Jun 2007 11:40:25 -0700
User-agent: Thunderbird (X11/20070604)

Phillip Susi wrote:
>>   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.

Untrue, actually: _handling_ the signals would not handle them in the
exec'd child (for obvious reasons), but POSIX requires blocked signals
to remain blocked after an exec.

Try the following:

trap "" TSTP
exec yes > /dev/null

and then try suspending the program with ^Z, with and without the "trap"
line commented out. :)

Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...

reply via email to

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