csh is nicer to its family than sh

David James Keegel munnari!murtoa.oz.au!djk at uunet.uu.net
Fri Mar 31 14:08:17 AEST 1989


by simon%robots.oxford.ac.uk at nss.cs.ucl.ac.uk (Simon Turner): 
] ------ Cut here for "reaper_p" ------
] #! /bin/sh
] 
] # Run the reaper -- expect to die shortly!
] reaper
] exit 0
] ---------- End of "reaper_p" ---------

If you change `reaper' to `nohup reaper', you should find that the
shelltool running sh will let the reaper survive.  Alternatively, you may
trap signals 1 (HUP) and 15 (TERM) inside reaper, to prevent its death.
Here is a new log file with most (but not CHLD) traps caught:

My PID is 6496
My parent is PID 6495
My grandparent is PID 6494
Killed my parent (PID 6495)
My PID is still 6496, but my new PPID is 1
Killed my former grandparent (PID 6494)
Reaper got signal 15
Reaper got signal 1
I'm still here...
Reaper got signal 1
Finished

I expect that the shell is sending signals to everyone in its process
group when it gets killed; this would include reaper even though it has
been `orphaned'. It was these signals which caused reaper to die.

			David Keegel    (djk at munnari.oz)



More information about the Comp.sys.sun mailing list