Get notified when a process or application is killed/forcekilled?
I am trying to monitor if certain application has killed, crashed, for开发者_如何学JAVAce killed on system. How can I get such notifications on Mac.
What is the common approach to implement such design?
Thank you
Observing Process Lifetimes Without Polling
I believe the common approach, although probably not exactly what you're looking for, is to periodically poll your processes. For instance:
ps -A | grep 'someIndentifingString'
If this doesn't return anything, your process is gone.
This won't, though, tell you if it was caused by a crash, force kill etc., so I'm not sure that it completely meets your needs.
精彩评论