Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Actually I'm using supervisor to monitor a process and restart it when it stops for some reason. The problem is that in case of a supervisor crash the process stops get monitored.

So I thought to schedule a cronjob to check supervisor is running, and eventually restart it.

The next thing I'm considering is to get rid of supervisor and check my process directly from the cronjob. I read that sometimes supervisor uses too much memory (to be verified, though).

What are the pros in having supervisor VS cronjob monitoring the process?

share|improve this question

3 Answers 3

up vote 6 down vote accepted

Cron periodically calling a shell script to ensure a service is running is actually a pretty decent entry-level method for service monitoring on simple networks. Cron can check once per minute, so that may be good enough for the demands of your environment if downtimes of < 60 seconds is acceptable. It's easy to set up and use.

Supervisor, on the other hand, can handle the realtime signals from the kernel concerning the service process. This is MUCH shorter response than simple cron scripts. Using Cron to monitor your supervisord service is also not terribly difficult and will provide a good 2nd line of defense.

If you need to ensure that the service is up and responding in very short increments without ANY service drops due to single points of failure, you'd probably be better off with multiple-server service failover detection and more robust monitoring solutions. All of which will require a more complex network arrangement with more planning and maintenance investment.

share|improve this answer

On all my systems I have a cron folder(that is synced regularly). A single script that is set by crontab to run every 5 minutes that has my rules for what runs on which server and when(Like on my personal server it queries my FB once a week to get mine and friends music likes or to check movie/tv likes and compare them with my netflix queue, or more professionally check the company upload folder every 5 minutes to see if there is data to be analyzed).

Worth keeping in mind, depending on the process or other scripted commands, you can have your cron script run multiple times if it doesn't exit properly or takes longer then normal. So when you are going the scripted cron route, remember to have it first check if it is already running and possibly either kill the old process or wait for it to complete.

share|improve this answer

Cron can not launch the check more often than once a minute.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.