Timed self-destruct (for debugging programs that hang)

Bennett E. Todd III bet at ecsvax.UUCP
Wed Jan 8 02:57:40 AEST 1986


Well, I got a few helpful responses. I appreciate everyone's forbearance
with such ugly code.

I got suggestions for good tricks to play with adb, for ways to refine
the program I wrote, and other such tips. However, the real kicker comes from:
	Stephen Samuel
	{ihnp4,ubc-visi}!alberta!uofa-mts!stephen_samuel

who gets the prize for cleverest hack of the bunch:

( sleep 120 ; kill -9 $$ ) &
exec $*

His explanation is succinct:

"What it does is have the kill delete the primary process, which is then
replaced with the real intended program. Note that this also results in
a mimimum of extra procsses and NO temporary files."

Hat's off. I guess this illustrates the basic nature of UNIX; there is
generally only one correct way to do a thing, and many many wrong ways,
most of which will occur to you before the right one.

-Bennett
-- 

Bennett Todd -- Duke Computation Center, Durham, NC 27706-7756; (919) 684-3695
UUCP: ...{decvax,seismo,philabs,ihnp4,akgua}!mcnc!ecsvax!duccpc!bet



More information about the Comp.unix.wizards mailing list