I’ve written before about how I’m doing nightly SuperDuper! backups as part of my backup strategy. It’s a great piece of software, but in order to maintain backwards compatibility the developers are still using cron instead of launchd. This caused me no end of headaches setting up a rotating backup system, but there is one huge drawback I wasn’t able to work around – the inability to force the machine to wake from sleep (cron won’t run tasks while the mac is asleep).

For a while I just told my Mac to stop sleeping, but that’s a waste when on weekdays it sits idle for 2/3 of the day. I finally settled on a 2 hour sleep timer, but with the recent Age of Conan release the Mac has managed to be asleep at backup time more often than not.

It was on the way home today that the solution to SuperDuper’s narcolepsy finally hit me. I picked up Awaken back in April as part of a MacHeist bundle, and after a few teething problems with Growl I’ve been going to sleep and waking up to my music. Awaken makes full use of launchd and will happily wake the system up, so all I had to do was set an alarm a couple of minutes before the backup that didn’t play music 😀

It was while setting this up that another flash of brilliance hit me. Awaken’s silent alarm requires a task to launch, it can’t be empty. So I figured, what better task than a script to quit Awaken since it was only loading to wake the mac from sleep 😀 😀

After playing with Automator and discovering that by default launching a workflow will edit it instead of run it (seems pretty stupid to me, but hey I’m a windows user at heart) I finally figured out how to make it work.

Awaken isn’t free, but if you do own it I present to you the final list of instructions:

In Automator:

  • Create a new custom Automator workflow
  • Under Utilities, drag Quit Application across to the workflow
  • Pick Awaken from the Application list, and untick Ask to save changes
  • Save the workflow somewhere useful

In Finder:

  • Locate the workflow you just saved
  • Click on it and type cmd+i (or file -> get info)
  • Under Open With, change it to Automator Runner (don’t hit change all)

You now have an Automator workflow file that when opened, will quit Awaken instead of bringing up the Automator edit view. To edit it later, you either have to manually load it into Automator or right click -> open with -> Automator.

Then, in Awaken:

  • In general preferences, ensure Wake Mac from sleep is checked (if it isn’t, you need to let your mac sleep. It gets tired, you know.)
  • Create a new alarm, give it a title, set occurrence and time to a minute or so before your backup
  • Set type to task
  • Drag your workflow into the Launch Item section

I’m really happy with this setup. It would be better if SuperDuper! supported this out of the box, but now that I’ve realised I can use Awaken as my own personal interface to launchd a whole world of possibilities are coming to mind 😀