0

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.

1
  • 1
    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, 2011 at 15:14

3 Answers 3

1

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.

0

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 http://god.rubyforge.org/ to monitor and automatically restart the program (using your rc.local entry)

Hope that helps.

0

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.

You must log in to answer this question.