开发者

Get notified when a process or application is killed/forcekilled?

开发者 https://www.devze.com 2023-03-21 09:04 出处:网络
I am trying to monitor if certain application has killed, crashed, for开发者_如何学JAVAce killed on system. How can I get such notifications on Mac.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消