0

I'm searching for a linux service that watches/checks every n seconds a list of running processes/daemons for detecting (and noticing+restarting the process) any issues (like a segmentation fault in nginx).

Is there any?

  • Monit is a common choice for this. However, it is also [very well-documented here.](http://serverfault.com/questions/tagged/monit?sort=votes&pagesize=50). Try checking the existing Monit questions to see if any fit your use-case. – ewwhite Oct 02 '12 at 15:54

2 Answers2

3

You can try monit. It can do more than just monitoring processes though which shouldn't be a problem I guess.

lsmooth
  • 1,521
  • 1
  • 9
  • 17
1

There are several. They're called watchdogs

DJB's daemontools does this (but it's icky. I'm not even giving you a link.)

There are also various examples of watchdog scripts people have written (this one is pretty decent) - usually it's a shell script that reads a PID file, checks to see if the corresponding PID is alive, and either notifies you or restarts the affected service if it's not.
They're typically run out of cron jobs every minute/5 minutes/ etc. - tighter granularity than that is almost never necessary in the real world.

If you have a proper monitoring system in place you can often hook your monitoring system so alerts go to a handler script that tries to restart services that are down (but beware the negative impact of false alarms here - restarting your webserver when you don't need to could cause more harm than good).

voretaq7
  • 79,345
  • 17
  • 128
  • 213