Re: watchdog processes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 04, 2005 at 06:42:02PM -0500, Carl Nygard wrote:
> 
> On Tue, 2005-01-04 at 23:02 +0000, Richard Worwood wrote:
> > Does anyone know of a product or scripts I can use to periodically check
> > that some key processes are running and restart as required?
> 
> 'man pidof'

Also, how critical are these processes?

For 'critical' processes the common system tool is to use
inittab.  See the respawn option. See also chkconfig.  Example:

	  x:5:respawn:/etc/X11/prefdm -nodaemon

Use this when debugging is finished.

You can also take advantage of the normal parent child relationship
(the way cron does) and have a script that 'waits' on the child
process.  It can then wakeup when the child exits, check status and
other management hooks to keep things from running away and restart as
needed.  The above X11 example is a good place to start.  Note how it
will try a handful of times to start then gracefully reports a
problem and stops hammering the system when X is not setup correctly
for example.

See the man page for the wait() system call and also look at the built
in hooks that your choice of scripting language presents you.

Other examples will be found in /etc/init.d/* ... note how
they are tied in with 'chkconfig' and also how they use
various lock files as control points.

Tinkering on the command line, note how the shell 'waits'
on the sleep command to exit prior to continuing.  

      $ while /bin/true
       do
       echo Going to sleep
       sleep 60
       echo Morning Nice day.
       date
       done

As long as the process doing work does not get clever and disconnect
from the controlling terminal or do a background thing then the
expected result is fine.  Compare with this bad example that has the
potential of cluttering the system with zombies.

      $ while /bin/true
       do
       echo Going to sleep
       sleep 60
       /bin/echo Morning Nice day.  &
       date
       done


-- 
	T o m  M i t c h e l l 
	spam unwanted email.
	SPAM, good eats, and a trademark of  Hormel Foods.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux