Let SystemStarter do your dirty work for you
No need to remember how to start/stop a process on your own if a good StartupItem was written for it.No, this is not a foray into the occult.
Some reading this article may already use Mike Bombich’s nice implementation of OSXvnc (a VNC server – a lighter (and cheaper) alternative to remote control with ARD) which he calls Share My Desktop (www.bombich.com).
I use SMD quite a lot in my installs (best to VPN to your box for this though! VNC is NOT secure!) since some OS X stuff still doesn’t connect very well to the command line. However I’ve noticed that the OSXvnc process has a tendency to crash or send out garbled screenshots after a number of weeks. It’s possible to restart the service with a _kill_ and then invoke the service with the right flags, etc. But, this is kind of a pain.
Happily, as I just discovered, Share My Desktop does things properly and adds OSXvnc to /Library/StartupItems as “VNC”. This means (from the SystemStarter man page) that you can kill the process for OSXvnc, then run just the part of the system boot sequence that launches the system vnc service:
sudo SystemStarter start VNC
The niceness of this is the simplicity of the syntax, and the fact that, if OSXvnc worked properly, you could use “restart” instead of “start” – there is some odd error that appears, though.
Word of warning – ‘sudo SystemStarter restart’ with no StartupItem specified restarts ALL processes launched by SystemStarter on boot – this seems to crash the machine. However, you can clearly see the potential value of being able to ‘cycle’ system services on a specific basis with this command…
Ed. Note: Most well behaved startup items should respond to “start”, “stop” and “restart”. You can check the actual startup item’s script to see which they implement.
For more info on this check out Josh’s article on Startup Items for more info.