I have a script that gets errors and I want to make it restart when it gets an error and stop restarting when it doesn\'t.