If you need some snippets or codes to run for ever, but not more that one instance, you need to rapidly check the code, or script and if it has died! It’s the time to run it again. To be sure of this function, just add the following lock handler at the top of your script
Read more at HowtoForge