Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I am Using Ubuntu Server and would like to know if it's possible to automatically restart services that go unresponsive. I am operating a standard LAMP stack and occasionally vital services need to be restarted but I want to do it in a programmatic way.

share|improve this question

marked as duplicate by Jenny D, Falcon Momot, Ladadadada, Andrew, Ward Sep 12 '13 at 5:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

By "Restart a lamp stack" do you mean to programmatically restart the various services that make up the full LAMP stack? Like restarting Apache and MySQL? Or do you want to automatically restart Linux when it kernel panics? That brings up another point, what do you mean that it's "crashed" - are we talking full kernel panic? – Wesley Mar 29 '13 at 16:23
Yes restart each service programmatically – chrisjlee Mar 29 '13 at 18:26
I heavily modified your question in an attempt to keep it on-topic and avoid being closed as a shopping question. – Wesley Mar 29 '13 at 18:42
Thank You @WesleyDavid – chrisjlee Mar 29 '13 at 18:44
up vote 1 down vote accepted

To handle services that go into a crashed state, look at Munin and/or the Linux watchdog daemon.

share|improve this answer
What does restarting user-mode services have to do with the kernel watchdog? – einpoklum Sep 11 '13 at 6:25

Supervisord and along the same lines Mozilla Circus are also interesting plays.

share|improve this answer

You can try to use monit to do this.

share|improve this answer

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