If my software has aborted because of an error, is there a way so that my Ubuntu will right away re-open it? I'm using g++ sample.cpp -o sample and ./sample
But if it crashes it's really a problem for me. What would be the solution? Thanks.
A simple bash script?
#! /bin/bash until ./my_app; do sleep 2 # To prevent insanity done Simple solution would just be to make a shell script to start the program every time it finishes execution.
example:
#!/bin/bash while true do ./sample done You may want to save a log file or the program output each time sample finishes execution.
sleep to the loop.foo.sh. Then make it executable with chmod +x foo.sh. Then execute like so: ./foo.sh. Alternatively you can enter each line at the bash prompt, just leave off the first line (although you should probably save it as a script if you plan on running it again).Possibly overkill for what you're after, it's hard to tell, but the God monitoring framework might help - a little more advanced and feature-ful than a simple while(1)