PDA

View Full Version : Check if a process has crashed




tofagerl
Feb 13, 2013, 09:29 AM
I'm having problems with the Carbonite backup app on my mothers laptop. It will crash and use all available CPU untill I manually force close it. Obviously, this is not ideal, and several times I only find out that this has happened after receiving an email from carbonite saying that it hasn't backed up for X days.

So I have to options. One is to have cron close and restart it every X hours, and the other is to check via cron if the process has crashed (it will still be running, so pidof isn't an option) and only then close/restart it.

I'm pretty sure bash doesn't know how to check if an app has crashed, but does AppleScript? How about any other scripting languages? Python?



robbieduncan
Feb 13, 2013, 09:56 AM
There is no general purpose way to confirm if an app has crashed. Anything that claims to essentially relies on the process responding to some sort of signal within a time period. Failure to do so does not guarantee the process is crashed.

tofagerl
Feb 13, 2013, 09:57 AM
Which is out, since I have no idea how the process would respond... Maybe I could measure CPU time over a period of ten seconds or something, but that seems like it would have tons of false positives when a backup is actually run.