#!/bin/sh
if ps -auxww | grep \/OSXvnc.app\/ | grep -v grep ; then
exit 0
else
open /Applications/OSXvnc.app
exit 0
fiSave this some where in your path like ~/bin and make it executable with chmod +x checkvnc
All it does is do a ps (of all running commands hence the -auxww) and if it finds the string "/OSXvnc.app/" (I've included the /s so if there is another app called 'somethingOSXvnc.app,' it will still work. I've also included the "grep -v grep" command so that it removes any lines with "grep" included in them. Then it will print the ps line to the STDOUT (Standard out). If it doesn't have any output, then it will open OSXvnc.app using the command "open". Then I just added this line to /etc/crontab:
5 * * * * jameso /Users/jameso/bin/checkvnc > /dev/nullThose spaces are tabs, do a search on cron or crontab. This line just runs the command every five minutes, and sends all output to /dev/null, which is the unix "long drop." Basically, if it goes into /dev/null, it never comes out.
If you want to edit this script for other apps, remember that you need to use \ for any special characters.
[robg adds: There is no OS X version of VNC from realvnc.com (yet; you can send feedback and ask for one!), but you can find a few on VersionTracker by searching on VNC; Redstone Software has the newest version I've seen...]

