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?
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?
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).