View Single Post
  #4  
Old 07-25-2007, 08:21 AM
Wings Wings is offline
Registered User
 
Join Date: Mar 2007
Posts: 10
I Know What To Type!

This may or may not be helpful to most people, but I sure wish someone had posted this for me a long time ago. I finally figured out how to automate an SD backup without using SD's built-in scheduling (which, for me anyway, wasn't working).

In my case, I have an external FW drive that I want to stay unmounted until the automated backup runs, and then unmount itself when done. I want the machine to wake itself up at 3AM, and at 3:05 to mount the drive, then run SD, unmount the drive, then quit SD.

In Energy Saver I set the machine to wake up (and/or power up) every day at 3AM. In iCal I have an alarm set for 3:05am that runs every Tuesday, Thursday and Saturday. The alarm runs a saved Automator script (saved as an application).

The Automator script runs in 3 parts, although it can be done in just one part. Part 1 executes a script that mounts the drive, part 2 is just a short 2-second delay (not needed but it makes me feel better), and part 3 runs SD, and passing it SD's previously saved settings file (the file you save in SD once you have everything set up the way you like).

Here is the Automator script. It's what you type into the window you get when choosing ""Run Applescript" from the Automator library. (My backup drive is named "Backup"; use whatever yours is named.)

Part 1:
on run {input, parameters}

set diskName to "Backup"
set deviceName to do shell script "diskutil list | grep \"" & diskName & "\" | awk '{print $6}'"
do shell script "diskutil mountDisk /dev/" & deviceName

return input
end run

Part 2: Just a 2-second pause.

Part 3:
Another "Run Applescript":

on run {input, parameters}

tell application "SuperDuper!"
run using settings "/Users/richard/Documents/MyBackupPlan/BackupSettings.sdsp"
end tell

return input
end run

The file "BackupSettings.sdsp" was the file I saved in SD after I got SD set doing what I wanted it to do. There is an easy way to get that file name, and the path to it, inserted into the script without typing (and without typo errors). First select everything between the starting and ending quotes in the portion "/Users/richard/Documents/MyBackupPlan/BackupSettings.sdsp" and delete it (since that is the path to MY file), then go to wherever you have saved your .sdsp file and drag that file icon between the 2 quotes that you didn't delete, and it will insert the full path name for you.

Save the Automator script as a workflow file (so you can edit it again if needed), and also as an application. The saved application is the file you tell iCal to run when its alarm activates (and make sure you set iCal to run it "0 minutes before", not 15, which is its default timing.)

Also, to automatically unmount the drive when done, I have set SD to run a script that unmounts the drive when it finishes its backup. That script was entered into Apple's Script Editor and saved as an application. It is this saved application that I tell SD to run when done. That script is:

tell application "Finder"
eject disk "Backup"
end tell


Hope this helps a few people.
Reply With Quote