[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 1.5.0.12 (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:
----
#!/bin/sh
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...
http://micah.cowan.name/
- Re: nohup feature request / Please fwd to Jim Meyering, (continued)
- Re: nohup feature request / Please fwd to Jim Meyering, Pádraig Brady, 2007/06/07
- Re: nohup feature request / Please fwd to Jim Meyering, Phillip Susi, 2007/06/07
- Re: nohup feature request / Please fwd to Jim Meyering, Bob Proulx, 2007/06/07
- Re: nohup feature request / Please fwd to Jim Meyering, Phillip Susi, 2007/06/12
- Re: nohup feature request / Please fwd to Jim Meyering, Bob Proulx, 2007/06/12
- Re: nohup feature request / Please fwd to Jim Meyering, John Cowan, 2007/06/12
- Re: nohup feature request / Please fwd to Jim Meyering, Phillip Susi, 2007/06/13
- Re: nohup feature request / Please fwd to Jim Meyering, Bob Proulx, 2007/06/13
- Re: nohup feature request / Please fwd to Jim Meyering, Phillip Susi, 2007/06/14
- Re: nohup feature request / Please fwd to Jim Meyering,
Micah Cowan <=
- Re: nohup feature request / Please fwd to Jim Meyering, Phillip Susi, 2007/06/14
- Re: nohup feature request / Please fwd to Jim Meyering, Andreas Schwab, 2007/06/14
- Re: nohup feature request / Please fwd to Jim Meyering, Micah Cowan, 2007/06/14