Important: I back up to a time capsule, via wifi.
- I set my computer up to automatically wake up at 2:58 AM.
- At 2:59 AM I run a script that launches "caffeinate -s", in order to prevent my MacBook to go back to sleep.
- At 3:00 AM I run a scheduled Time Machine backup - Time Machine itself is turned off in the settings, though.
- I run another script that kills caffeinate when the backupd process is gone, so my Mac can go back to sleep.
My goal: Only run backups at night, when I usually do not use my MacBook.
What happens: - When I make the Mac sleep, but have the lid open, it works as I'd like it. - When I make the Mac sleep by closing the lid, it doesn't work. Time Machine can't find the backup device.
This is the caffeinate script. backupd is launched with TimeMachineScheduler.
#!/bin/sh
/usr/bin/caffeinate -s &
while [ ! "$(pidof backupd)" ]; do
sleep 10
done
while [ "$(pidof backupd)" ]; do
done
/usr/bin/pkill caffeinate