How to write "app start" command in app

I want the app auto stop and start run again when the get some error or something make app Error.

Does anyone have an example??

You can use faultAction with restartApp option