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

Re: Mutt viewers in the background / Job control



For the archives:

On Sat, Nov 08, 2003 at 04:16:23PM -0800, Bill Moseley wrote:
> Common question:  how do I make the viewer a child of init so that when
> mutt exits it's not a zombie waiting on the viewer or closing mutt
> doesn't kill the viewer?

Well, one answer would seem a script called mutt_view that does:

file=$(mktemp);
cp "$2" "$file"
( setsid "$1" "$file"; rm "$file" ) &

So that seems to fix the problem of mutt exiting and closing child
processes.  I use that when forking daemons under Perl (perldoc perlipc)
all the time, but don't fully understand the concept of process
"groups".  Explanations welcome.

My original question was how to make the viewer a child of init.  Just
adding the "&" does that, but I guess the shell script and viewer
program are still part of the same process group (with mutt being the
"leader").   setsid gives the process its own process group id, so (I'm
assuming) that allows mutt to exit and not bring the viewer program with
it.


-- 
Bill Moseley
moseley@hank.org



Reply to: