Run Network TimeMachine Backups in OS X 10.8 Mountain Lion on Your Custom Schedule
Saturday, 22 September 2012
This is an update to a previous article I wrote…
Like many people, I find Time Machine’s default settings for backups to be excessive. I seldom need daily backups, let alone hourly backups. Instead, I prefer to schedule weekly backups to my NAS.
My preferred way of doing this is to schedule a Calendar event. However, Apple changed things around a bit with 10.8, so in order to get the Calendar event to actually run the AppleScript necessary to start the backups you need to follow a slightly different procedure:
- First, open Automator. From the File menu choose New, and select Calendar Alarm as the type.
- Next, add a Run AppleScript Action by searching for in the search field, or selecting Utilities, Run Applescript from the menu.
- In the Action view that opens highlight the section that says “(* Your script goes here *)” and delete it. In it’s place add the below code (replacing YourBackupDisksName with the actual name of the backup disk that gets mounted when you run your backup, which you can find by starting a backup while a terminal window is open and typing “ls /Volumes“):
do shell script "if [ -e " & quoted form of "/Volumes/YourBackupDisksName" & " ]; then diskutil unmountDisk " & quoted form of "/Volumes/YourBackupDisksName" & "; fi" delay 10 do shell script "/System/Library/CoreServices/backupd.bundle/Contents/Resources/backupd-helper &"
- Save the shell script as whatever you want to call it. Automator will then open Calendar, with your new event added. You can then customize the scheduling to repeat as you’d like
The first line of the code in the Applescript Action above unmounts the drive as sometimes Mountain Lion won’t unmount the disk containing your TimeMachine backup, which will then cause backupdhelper to fail.