Monitoring and terminating a hanged process in Linux

Posted by Yoav on Server Fault See other posts from Server Fault or by Yoav
Published on 2010-03-17T09:33:27Z Indexed on 2010/03/17 9:41 UTC
Read the original article Hit count: 411

Filed under:
|
|
|

Hi,

I'm writing a script that runs many simultaneous processes that run the "dig" command. Once in a while (relatively rare, but happens in every run since I run dig many times) the dig command hangs with 0% CPU. Therefore, my script never terminates. I've created a monitor process for each dig command I run, which terminates it after a while, but I was wondering if there isn't a simpler and more efficient way to run a process with a pre-determined "expiration date", i.e. if the process runs more then X seconds it gets a signal that terminates it.

Thanks!

© Server Fault or respective owner

Related posts about linux

Related posts about posix