PDA

View Full Version : Multi-volume backup using Finder Folder Action


jszedula
05-03-2007, 06:32 PM
I'm using Finder's Folder Action "adding folder items to" to trigger a backup using SuperDuper! when:
1. A volume is mounted named like "B-Macintosh HD"
2. Another volume already mounted named like "Macintosh HD"
3. a SuperDuper! settings file exists with the name like "Backup Macintosh HD"
The script will work for any volume as long as there is a matched set when "Macintosh HD" is replaced by some other volume name. I can backup all the volumes on my computer plus any external drives I might want to backup as well.

This piece of Applescript code works but I was wondering if there was a better way to do this:

tell application "Finder"
-- ...
-- other code to verify proper backup conditions exist goes here
-- ...
with timeout of 3600 seconds
tell application "SuperDuper!"
run using settings SettingFile without user interaction
quit
end tell
repeat while (process "SuperDuper!" exists)
do shell script "sleep 10"
end repeat
end timeout
end tell

Is there a way to not use the "repeat" to see if SuperDuper! has finished? I put the "repeat" loop in because when I used a backup disk with multiple partitions that satisfied the 3 trigger conditions SuperDuper! seemed to be starting the next backup before it even finished the first one. I originally did the "quit" at the end of the script. It's as if the "run using settings SettingFile without user interaction" commands are placed into a queue and not waiting for each one to complete before moving on.

Also is there a way to get rid of the count down the precedes the start of the backup? My script asks if the backup is to be done if the 3 triggers are satisfied so a "Cancel" countdown is unnecessary.

dnanian
05-03-2007, 06:42 PM
Sorry, there's no way to get rid of the cancel count down. But why not use our existing schedule script driver as a base? You'll find it inside the SD! applications package in Contents/Resources/Copy Job Script.template...

jszedula
05-03-2007, 07:03 PM
Because I want the backup to start when I mount the drive.

I don't want to leave the drive on waiting for the scheduled backup time.

I've partitioned my disk into a Mac OS X & application partition and a user data (including my home directory) partition. The Mac OS X partition only really needs to be backed up before any updates are done (which I do manually and just in case the updates are a problem). I don't need to do a backup my user partition every day but I may want to backup several days in a row if I've done a lot of work that should be backed up.

jszedula
05-03-2007, 07:04 PM
You really didn't answer my question about:

Is there a way to not use the "repeat" to see if SuperDuper! has finished? I put the "repeat" loop in because when I used a backup disk with multiple partitions that satisfied the 3 trigger conditions SuperDuper! seemed to be starting the next backup before it even finished the first one. I originally did the "quit" at the end of the script. It's as if the "run using settings SettingFile without user interaction" commands are placed into a queue and not waiting for each one to complete before moving on.

dnanian
05-03-2007, 07:06 PM
There's no way to do it without a repeat, no. But, really, look at the schedule driver script. You can definitely do this with our script... in fact, see the "One Touch Button" FAQ for details of how to use it for something other than scheduling.

jszedula
05-03-2007, 07:29 PM
How can I use the "One Touch Button" FAQ if I do not have a Maxtor OneTouch drive? I have an OWC firewire 2.5" enclosure that I use to backup my Mac's hard drive.

dnanian
05-03-2007, 07:32 PM
It's an example of an approach. So, if you wanted to back up when a drive was attached, you could -- for example -- use Do Something When (see Version Tracker) and have it run the little executable. Or, your own script could run ours.

jszedula
05-03-2007, 07:44 PM
I guess I could download & install "Do Something When" but how would that be any better than using the built-in Finder's Folder Action "adding folder items to"? Won't I still have the problem of multiple actions trying to run at the same time when I mount each partition and the backup is triggered by "Do Something When"?

Without spending more time with "Do Something When" to find out, I don't know if I'll be able to solve the multi-volume backup issue or prompt for a "do backup"/"don't do backup" response before actually doing the backup?

It looks like I have a working solution that does not require any more software than I have nor any more time spent figuring it out.

dnanian
05-03-2007, 07:53 PM
Again, that's just an example. You can trigger things any way you want.