Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- monitor for sleeping processes
December 23, 2004, 3:03 pm
rate this thread
Re: monitor for sleeping processes
> I'm a complete perl newbie... Can anyone assist with a little bit of perl
> to monitor for a process that is constantly sleeping. Once it's decided
> that the process is sleeping, it sends a wee mail! :o)
> Any help/pointers would be much appreciated.
What OS are you using? If it is unix, then you can capture, parse, and
check the output of the ps command:
my @status = `ps -af`
using whatever options are appropriate for your flavor of ps. You would
want to check the TIME column at periodic intervals and look for
entries where it is not changing, and the STAT column for entries which
never indicate they are running. This is a relatively crude method, but
it is difficult for one process to find out the status of another
You can also look into Proc modules on CPAN, such as Proc::ProcessTable
A better approach would be for each process in question to implement a
heartbeat or watchdog type mechanism, such as periodically updating a
file, a database entry, or sending a message of some sort. However, if
you don't have the ability to modify those programs, then you have to
use something less sophisticated.
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
http://www.newsfeed.com The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----