How do I shut off a USB fan automatically when the Mac goes to sleep? I have a Mac Mini 1.1 on which I updated the EFI firmware to v2.1 and installed Mac OS X 10.7

I'm wondering how I can cool the Mac with an external fan somehow.
I found the internal cooling to be slow, so I put an external handmade USB fan on the system in an open case and this works well for my purpose.

The problem with the external fan is that when I put the computer to sleep, the fan keeps on working and I don't know how to make it stop.

I don't want to use the system fan as it looks very weak and makes a lot of noise at 3000 rpm. I don't like noise.
To expand on the accepted answer, on some desktops, hibernatemode 1 is not available, see the manual page for what's available, go to terminal:

$ man pmset


(q to exit the man page, or esc, then q key)

Scroll way down to "SAFE SLEEP ARGUMENTS", it'll list which hibernatemode is available on your system, my old iMac says 0, 3, 25

I set it mine to 25 (write RAM contents to disk, then full power down). Originally devices like USB hubs won't power off when the system is in sleep mode, now it does.

However doing this will make sleeping and waking much slower. I'm still trying to see if I like this, now I close almost all open apps before putting system to sleep to minimize disk activity. Not totally sure if I like this, might be easier to unplug that USB hub.