Creating a script that will execute a program and if it exits without crashing, will run it again
To keep restarting the job on succesful exit You can use launchd on OSX. For this You have to prepare *.plist file in order to "tell" launchd how to behave.
To restart application on succesfull exit please look at KeepAlive -> SuccessfulExit key (more info: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man5/launchd.plist.5.html).
To start your job, You'll need to start it via launchctl command, for example:

launchctl load path/to/file.plist


To stop it:

launchctl unload path/to/file.plist


More informations about launchctl/launchd programming here:

http://alvinalexander.com/mac-os-x/launchd-examples-launchd-plist-file-examples-mac

http://launchd.info