Thursday, November 8, 2012

[Tutorial] Never dying program (How to automatically restart a program if it dies/crashes


When you have an unstable server that keeps crashing, normally you would have to access the server via SSH and restart the server. This is a tedious work and if you need the server up and running and if you don't have access to the computer then it can be extremely annoying.


In order to solve this problem, you can write a simple bash script that checks periodically if a specific program is running and run it if not.

 ps ax | grep -v grep | grep custom_app

** Ill include the script in a few hours.

Now you don't have to worry about restarting your server again!
But just keep in mind, this script will not be able to do anything if your server freezes!

No comments: