How To Restart VNC on OS X
When the VNC server on a Mac crashes, you can restart it by rebooting the computer or possibly by restarting it from the Sharing menu in System Preferences by clicking the checkbox on and off. To restart it remotely, you need to have the Remote Login enabled (see below).
After you login by SSH to the Mac, run the following command to restart the VNC server:
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -restart -agent