Not stopping program (using shell script)
문제
I have a binary program named as some thing like "mm.out". This program has some unexpected bugs and the bugs causes it to stop. I want to write a service or shell script to execute my binary again if it stopped unexpectedly. How should I write this program?
해결책
You should fix the program. But if you really want this, run it in a loop:
while ! mm.out
do
sleep 5 # Just in case the program dies immediately
done
다른 팁
Let a shell script execute it and wait for a return code, if that code isn't 0 restart the program.
제휴하지 않습니다 StackOverflow