Power or other problems related to unexpected system sleep, shutdown, lights or fans call for an SMC reset:
Resetting the System Management Controller (SMC)
- Shut down the computer.
- Unplug the computer's power cord.
- Wait fifteen seconds.
- Attach the computer's power cord.
- Wait five seconds, then press the power button to turn on the computer.
Thanks for the quick reply - I put me iMac to sleep (which reset when it powered back up, not on sleep) logged in and see a reply before I've had a chance to edit my question!
Ok, I'll try a SMC reset. Just to clarify - it does in fact sleep ok, with the sleeping led strobing gently, but on waking up it bongs and reboots.
I'll edit this post if it works or doesn't in 5 mins.
Thanks John, that didn't solve it BUT it did help - while unplugging the power I unplugged the external powered usb hub which allowed the sleep to work properly.
Unplugging everything one at a time eventually led me to the external dvd writer, which is powered by 2 usb ports. Well, it turns out that my usb hub was no longer powered, so on waking up from sleep mode I'm guessing (much) more than 500ma of power was being drawn from the one iMac usb port, causing the problem.