LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Restart Program when crashed (https://www.linuxquestions.org/questions/linux-newbie-8/restart-program-when-crashed-787272/)

prudens 02-05-2010 12:28 PM

Restart Program when crashed
 
I have a program called HelloWorld, but it crashes a lot,

is there anyway to tell Linux to automatically check if Hello World crashed, and if it is crashed, restart HelloWorld?

Thanks!

P.S. Running Ubuntu

David the H. 02-05-2010 12:58 PM

Searching for "restart" in apt turned up a few promising hits.

launchtool
monit
restartd

I haven't tried any of these myself.

A simple brute-force way is to run it in a loop.
Code:

while true; do command ; done
Any time the command terminates, for any reason, the loop will start it up again. The only way to get out of it is to crtl-c terminate the loop.


All times are GMT -5. The time now is 01:37 AM.