I have my Cocoa app executing a shell script. I want to make it so that the shell script automatically kills itself if it finds that the host .app is not running. Right now what I have is the shell script polls using the UNIX "ps" command every time before it executes a command, and then kills itself if the app is not running. However this polling wastes resources, so is there a better way to do this?
I'm using Mac OS X 10.6 using the default bash shell.