If anyone else out there uses the OSXvnc server from osxvnc.com [Update:
osxvnc.com is no longer a Mac-related website; the domain expired and it's now run as a porn site! Do not try to visit there!] and used the OSXvnc-wrapper solution posted there to get it to automatically run and stay up, you may be interested in this script. You will have no doubt noticed when installing Classic applications under 10.1 that when it says it must close all applications, it means OSX applications as well. This gets into an interesting loop where it kills OSXvnc, which respawns, which then gets killed, etc. As a "hack" solution, I use the following as a replacement for the OSXvnc-wrapper file:
while [ `ps -aux | grep 'Dock.app' | grep -v 'grep' | wc -l` = 1 -a `ps -aux
| grep 'Finder.app' | grep -v 'grep' | wc -l` = 0 ]
/Applications/OSXvnc.app/Contents/MacOS/OSXvnc-server `cat /etc/osxvnc-args`
the "while" command just inside the first 'do' loop has been broken onto two lines for easier readability. Put a space after "aux" and then everything from line two onto the same line.]
What it does is check to see if Dock is running but Finder isn't (this happens when you are installing software that requires closing everything) and if so, waits for this to change. Once it runs, if it gets killed for any reason, it waits 10 seconds and starts checking again. The 10 second wait was necessary since momentarily after killing OSXvnc, both Dock and Finder are still running (finder hasn't been killed), and OSXvnc will start up again and get in the weird loop again.
I got frustrated and created this when that mysterious loop cuased me to force boot one too many times and it corrupted my FS... :( now I don't have to worry about it :)
Hope someone else finds this useful.