Service monitoring daemon

Kevin Wang rightsock at gmail.com
Tue Aug 3 15:47:33 UTC 2004


if you use a cron job, it's 1- slow (only runs once per minute) 2- is
expensive, and 3- ps -aux is EXPENSIVE compared to other methods of
finding if a process is running or not.  (see also /etc/init.d/ntpd
'status', as imported from /etc/init.d/functions )

running a "daemon" process that does a "while 1 ; do run_my_program ;
done" has the potential for running in an infinite loop if something
goes wrong. also, the daemon process might get killed.

daemontools and init have solved all of these problems. decades ago. 
if a process dies, it gets restarted immediately. if it erstarts too
often in a given time period, a sleep is executed so that we don't
swamp the system. we'll try again later.  There's more to it.  Better
to use a well developed tool than to reinvent the wheel.

I'm not saying you can't do it that way, but that there are better
ways of doing it.

   - Kevin

On Sun, 1 Aug 2004 20:20:24 -0400, jeem machine <jmachine at gmail.com> wrote:
> On Fri, 30 Jul 2004 17:58:51 -0700, Mark <msalists at gmx.net> wrote:
> > Thanks guys, but this is all too high level. I am already using nagios for
> > the remote monitoring, but what I need here is merely a local script that
> > just checks if a certain daemon or process is still running and if not
> > starts it again - no remote, no alert, etc...
> > So it's more a "make sure it's still running and if not restart it" than a
> > monitoring thing.
> >
> > Thanks,
> >
> > MARK
> >
> >
> >
> 
> You could do this by:
> ps -aux | grep $servicename | grep -v grep)
> Then check if grep returned true
> isit=$(echo $?)
> #If this returns 0 then it is running if not restart the service.
> 
> This is how I would go about it. If you need an actual script I will
> have to consult my books.
> Jeem
> 
> 
> 
> 
> > > -----Original Message-----
> > > From: fedora-list-bounces at redhat.com
> > > [mailto:fedora-list-bounces at redhat.com] On Behalf Of Kevin Wang
> > > Sent: Friday, July 30, 2004 5:51 PM
> > > To: For users of Fedora Core releases
> > > Subject: Re: Service monitoring daemon
> > >
> > >
> > > see also Nagios
> > >
> > > http://www.nagios.org/
> > >
> > >
> > > --
> > > fedora-list mailing list
> > > fedora-list at redhat.com
> > > To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
> > >
> >
> > --
> > fedora-list mailing list
> > fedora-list at redhat.com
> > To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
> >
> 
> --
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
>





More information about the fedora-list mailing list