jvc@stl.UUCP (Vic Churchill) (08/08/86)
<for new readers, the story so far is about ways and means to arrange for a process to be started AFTER a specified process terminates.> Nice discussion. Now try the following: I would like a way to run a process for a specified time duration and then "gracefully" zap it. (Basically, it's to stop me becoming a net junkie. Limit the habit to a half-hour at a time!) So something like "fuze foo 30" has the effect : __ run foo __________________ eek! ______/ ^ ^ ___ back to shell \__ sit'n'wait 29 mins | 1min |__/ / / a gentle warning / a killer There seems to be no way (that I can see) that the csh job control facilities or the available process id info can allow the 'fuze' process to know the identity of its sibling. Is it really necessary to start doing ps|fgrep's and so on? All suggestions welcomed. (Well, most sensible suggestions anyway :-) ). this signature not a sentence. Vic Churchill (jvc@stl ...!mcvax!ukc!stl!jvc +44-279-29531 x 2546)
bet@ecsvax.UUCP (Bennett E. Todd III) (08/13/86)
In article <305@stl.UUCP> jvc@stl.UUCP (Vic Churchill) writes: > [...] >I would like a way to run a process for a specified time >duration and then "gracefully" zap it. > [...] So something like "fuze foo 30" >has the effect : > __ run foo __________________ eek! >______/ ^ ^ ___ back to shell > \__ sit'n'wait 29 mins | 1min |__/ > / / > a gentle warning / > a killer I had a not entirely unrelated wish: I was trying to debug a program that [1] put the terminal into raw mode (therefore disabling keyboard generated interrupts), and [2] was hanging inextricably. I didn't need to be able to set the time; 2 minutes sufficed. 2 minutes is therefore hardcoded into this shell script; you can rig whatever command parser you want on this (basically trivial) hack. I went through several revisions, the first of which was in fact a ps/grep cludge. This one, based on suggestions from various net readers, seemed to be the cleanest. I call it "timout": ( sleep 120 ; kill -9 $$ ) & exec $* That's it. Settable time parameters, advanced warning before the axe falls, and suchlike "are left as exercises for the reader". It did what I needed. -Bennett -- Bennett Todd -- Duke Computation Center, Durham, NC 27706-7756; (919) 684-3695 UUCP: ...{decvax,seismo,philabs,ihnp4,akgua}!mcnc!ecsvax!duccpc!bet