I have a variety of mac minis that I use to display stats and system status. Sometimes the Safari browser that is displaying the stats graphs on those remote mac minis locks up / runs out of memory. This makes using Remote Desktop to restart the remote Safari session impossible as I can't login to the machine. Rather than walk over to force a reboot I can ssh into the box and restart the WindowsServer (WindowsServer is the graphical user interface manager and is typically the thing that is borked).
To resolve this issue I ssh into the machine via Terminal and then run the following command:
sudo killall -HUP WindowServer
Any open applications will be forced to close so use the command with caution.