Re: Monitoring a shell process.
Re: Monitoring a shell process.
- Subject: Re: Monitoring a shell process.
- From: Vince DeMarco <email@hidden>
- Date: Thu, 5 Jul 2001 16:21:04 -0700
On Thursday, July 5, 2001, at 01:08 PM, Isaac Horton wrote:
Is it possible to monitor a daemon for changes? For instance. Say I
had a
cocoa application that was a wrapper for Apache. The wrapper allows for
you
to stop and start the Apache Server. My problem is monitoring Apache
incase
someone decides to stop/start apache via telnet, and then updating the
UI to
reflect the new state of httpd. If that is not possible, then is
possible to
monitor a file for changes(i.e.:httpd.pid). I am not partial either way.
From the lists that I've looked on, it doesn't seem as if NSNotification
allows for this kind of monitoring. Any help would be greatly
appreciated.
Instead of watching if httpd.pid has changed why don't you just
periodically open a socket the http server (on what ever port) and make
a simple request. If the request comes back then Apache is still
running, if it isn't then someone stopped Apache.
If you did the above you could also use youre program to say monitor if
some other webserver on a completely different machine was up or down.
You use NSNotification to post a notification to let the rest of the
application know about something. It doesn't do the listening for you.
vince