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

I have a program that I added to /etc/rc.local to have it run as soon as the server starts. The problem is that sometimes the program stops responding and I need to restart it but I can not restart the server. I can only restart the server at night but the program sometimes dies during the day.

share|improve this question

migrated from Mar 8 '11 at 15:28

This question came from our site for professional and enthusiast programmers.

A) you should probably accept some previous answers to your other questions. B) This is better suited to another site like serverfault, superuser, ubuntu or linux. C) It depends on how you added it, bu /etc/ini.d/whatever start might do it. – chmullig Mar 8 '11 at 15:14

Instead of putting it in rc.local directly, the "proper" way to do it is to put a script in /etc/init.d that will respond to 'start|stop|restart' to do the right things to the program's process, then have the system symlink it into the rc directories via update-rc.d scriptname defaults.

Then, use service scriptname restart to restart it.

share|improve this answer

As mentioned by Shane you'll want to create an init script to start/stop/restart the service. As far as the program not responding, you'll want to find the root cause of that first. You can also use GOD to monitor and automatically restart the program (using your rc.local entry)

Hope that helps.

share|improve this answer

It is possible Ubuntu already has such a facility built-in via the standard rc system, but you might Google around "ubuntu daemon health monitor" and the like. I found a program called monit which you could probably install and configure to check in on your process and restart it when it fails.

share|improve this answer

Your Answer


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