mindmaster
mindmaster

Reputation: 1755

Python daemon to check if process hang in Linux

I use Skype under Ubuntu 12.04 and sometimes it's getting hang (I used word stuck before) - I don't receive messages and my messages are not delivered. It's hard to spot when this happens, because there are no errors or warnings. If at that moment I kill the Skype process it's not being killed (unless I do kill -9).

So, my idea is to create a Python daemon which will check if Skype is stuck every minute and restart the process if it is.

My question is how does one check whether a process is hang?

Upvotes: 3

Views: 943

Answers (1)

alehro
alehro

Reputation: 2208

I doubt if it is possible to determine hang up of a process in general. But for Skype it is definitely possible. Skype has well defined API. So, you can ping it every minute.

Here is it: http://developer.skype.com/public-api-reference#Linux

Here is example of API usage on Windows in C++: http://devforum.skype.com/t5/Desktop-API/C-Skype-Desktop-API-Example/td-p/8175

If you need more examples you can ask on the forum. The people there won't punish you for the grammar.

Upvotes: 1

Related Questions