I just got my old Beige G3 running as a server (bind, web and so on) and I can control most things quite happily with the CLI and with xWindows. Sometimes, though, there is something I can only do with Aqua. I have used VNC in the past to remotely control a display (handy if you work at an internet cafe and need to do something to one of the computers), but have found VNC buggy at the best of times on OSX (and most other OSes as well, is there any thing else?). I got bored of sshing into the box and running "open /Path/To/VNC/Server" if it crashed, so I wrote a shell script to check if VNC is running and if not, to start it. Here it is:
#!/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
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.
Mac OS X Hints
http://hints.macworld.com/article.php?story=200303030447096