Linux.com

Home Linux Community Forums Software Command Line Good watchdog for services?

Good watchdog for services?

Link to this post 14 May 09

You can try nagios...It's far away from being simple to configure but certainly is one of the best "watchdogs" out there.

~nm

Link to this post 14 May 09

If the program creates a pid file you can use checkproc

Usage:
checkproc -p <pid file> <app name>

Example:

checkproc -p /var/run/daemon.pid /usr/local/daemon/daemon.pl

I use this in my init scripts for all my perl daemons.

It could be easily used in a bash script to check the return / exit code.

Example
echo $?

Exit Codes:
0 = Running
1 = Dead but pid exists
3.= Dead and no pid

You may also want to read up on startproc and killproc. I suggest starting with the man pages. There are lots of useful options that can make your bash script very powerful. Then pop it into cron to automate it.

Enjoy

--
Shawn

Link to this post 15 May 09

If you are running Fedora 9 or later, or Ubuntu 6.10 or later, the good ol' standard init system has been quietly replaced with upstart.

They actually almost did too good of a job implementing this, since most people didn't even notice the change. ;)

While I've never set it up to do this, it is supposed to be able to monitor services and restart them automagically if they die.

Its configuration (at least on Fedora) lives in /etc/event.d

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board