I have a python program which, from time to time, crashes with a number of different exceptions usually due to network issues. The only way to get it to work is to restart it. How would I write a shell script to run the process, continually check if any of the output says Error
and if so end the process and restart the command (let's call it ./command.sh
)?
It would be fine for this to be in any other language (python/perl etc).