I connect to my network machines with VNC over SSH. On a few of my machines I have compiz running and it slows down the connection a bit and is just a bit annoying remotely. Id like to write a script to check if Compiz is running, and replace metacity as soon as the SSH connection is established. Is it possible to fire off a script as soon the SSH connection is made on the client? What files would need to be changed in order to do so.

I know there are a few ways to accomplish the same thing but this is the method that I would prefer to use as not to create any extra icons, or have to run a command as soon as i connect. Not to sound rude but this is the only method im interested in so please do not reply to this thread with other work arounds. Thanks!