I have a UNIX program that, depending on the passed in options, could take a couple of minutes up to a couple of days to execute. This program talks to hardware through blocking calls that normally come back in at most a few minutes. However, when 'hardware problems' occur, the program would simply hang (because of blocking calls, as expected). Since these 'hardware problems' could occur at any time, I would like the program to send me an indication (an email probably) wheneven such a hang condition is detected.
I know how to send an email out once the hung state is detected. The question I have is how do I find out that this program is hung on a blocked call? In other words, I need a perl script that would look at the Program Counter (PC) of my program and see if the PC has not changed for some predefined time interval. Can that even be done? Any suggestions?