[UFO Chicago] Shell scripting, timeouts

Jordan Bettis jordanb@hafd.org
Fri, 14 Feb 2003 13:01:58 -0600 (CST)


Jesse Becker said:
> --- Ian Bicking <ianb@colorstudy.com> wrote:
>> There's this unreliable program (wvware) that is being
>> run on a server
>> I'm using.  Sometimes it goes into an infinite loop and
>> takes up lots
>> of CPU while it's just sitting there.
>
> Someone else in the thread commented on killing a process
> after it uses too much CPU time (which can be different
> from walltime).  Being the nut I am, here's a small program
> that will return, in seconds, the user and system time used
> by a given process.  I'll merge it with my other program
> later--the other code is on my laptop, which is off at the
> moment.  This will *ONLY* work on linux, and nothing else.
> My other program actually has a chance of being portable...

You can do the cpu time check in a portable way too:
<http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC17>
-- 
Jordan Bettis <http://www.hafd.org/~jordanb>
This message has been written using my webmail system.