I'm one of those greatly suffering from the problem with TM in which the entire backup sparsebundle on a NAS gets corrupted if the Mac goes to sleep in middle of a backup operation. There's a [long process for recovering the backup][1], but it would be far better to avoid the corruption in the first place.

Is there any way to hack the sleep function so that the Mac refuses to go to sleep if a TM backup is currently in progress? Or, if that's not possible, is there at least some way to show a confirmation dialog when manually choosing "sleep" from the apple menu, to prompt for a manual verification that no TM is currently running?

**Clarification:**
One of the situations I need to protect against, is my habit of manually choosing "sleep" from the apple menu. Hence, something like Caffeine which only prevents automatic sleep, isn't a solution for me.


  [1]: http://www.garth.org/archives/2011,08,27,169,fix-time-machine-sparsebundle-nas-based-backup-errors.html