Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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, 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.

share|improve this question
    
As a last resort you could try using the Caffeine app (itunes.apple.com/us/app/caffeine/id411246225?mt=12). When you start Caffeine an icon will be placed in the menu bar that will allow you to prevent your Mac from going to sleep when enabled. A better solution would be if you could find a way to automatically disable sleep before TM starts and reenable sleep after TM quits. Someone who knows AppleScript could probably put something together pretty easily. –  recklesscoder Apr 13 '13 at 15:20
    
@recklesscoder please see clarification. –  GJ. Apr 13 '13 at 18:31
add comment

2 Answers

I have solved this for me 4 days ago with a bash script. It involves caffeinate built-in command and NoSleepCtrl (prevents sleep on lid close).

In my setup, I have TimeMachine disabled and run it using this command. It should not be difficult to create a wrapper, which would execute it periodically and either ask user for confirmation or wake the computer up and do it automatically.

My experience and steps for TM backup corruption on QNAP.

share|improve this answer
    
please see clarification. –  GJ. Apr 13 '13 at 18:32
    
Give try to the NoSleep utility. It does prevent sleep, even if you invoke Sleep from menu. I have checked it using simple: while true; do date; sleep 1; done. On caffeinate only it stops; with NoSleep screen goes blank, but loop does not stop. –  brablc Apr 13 '13 at 18:50
add comment

Yeah, I was thinking of recommending the Caffeine app, especially if you are in the habit of kicking off Time Machine backups manually.

Another option might be to go into System Preferences > Energy Saver and setting your computer sleep timer to closer to 3 hours. Be advised, though, that this will increase the amount of energy your computer is consuming (since it will be awake longer for each session). You can keep your display timer down to a more reasonable duration to save power. Display sleep won't affect Time Machine.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.