PDA

View Full Version : How do I trigger one SD unattended backup from another?


ixnayus
06-19-2009, 12:11 AM
I just got an external 1tb drive that I want to use to back up two separate internal drives. The problem is I want to do this unattended but I can't seem to figure out a way to run two jobs sequentially.

My desired workflow would be to have an automator action that triggers the first backup. I'd turn off my monitors and head home for the night while SD! does it's magic. When the first backup is complete, it would trigger the second backup. When the second is done, it would put the computer to sleep.

Now, I had a similar setup running just fine with a single SD! backup. My automator script used applescript to launch the SD! job and it would put the computer to sleep when it is done. However, now that I've introduced the second job into the mix, I need a way to trigger the second job once the first is done. Scheduling isn't a viable option since I don't know when the first job will be done. And Automator doesn't wait for the first job to complete before moving on with it's workflow once an unattended job starts running.

Can anyone suggest a way to do this? Details rather than generalities would be most appreciated, but, in truth, I'll take what I can get at this point.

Many thanks,
Steve

dnanian
06-19-2009, 07:57 AM
You don't have to know when the first job is done to do it with scheduling. Just set them one minute apart and we'll do the rest.

ixnayus
06-21-2009, 12:15 AM
You don't have to know when the first job is done to do it with scheduling. Just set them one minute apart and we'll do the rest.

Thanks for the tip, but unfortunately I can't rely on a scheduled trigger since I don't always leave the drive on and attached. I'd really just like to trigger the jobs on an as-needed basis.

Can I fire a unattended job with a shell script, maybe?

Thanks,
Steve

dnanian
06-21-2009, 01:22 AM
You can review the "One Touch Button" FAQ entry and use a similar technique, sure.

ixnayus
06-21-2009, 08:49 AM
Okay that worked. For posterity, here's what I did:

I have two internal drives, Sam & Max. I want to back them up on demand to an external drive ("MyBook") via an Automator Script. I want to leave this script running unattended after I leave for the night and have my computer sleep as soon as SuperDuper is done.

1) I create the SuperDuper jobs I want to run. I make sure the padlock icon is unlocked to allow the job to run unattended for both jobs.

2) I create an automator job that triggers the "Sam" job first. In a "Run AppleScript" workflow item:

tell application "SuperDuper!"
run using settings "~/Library/Application Support/SuperDuper!/Saved Settings/Backup Sam to MyBook.sdsp" without user interaction
end tell

Save this as "SuperDuper! Sam to MyBook.app" (save as an app, not a workflow!) somewhere handy. This is the thing you'll launch when you want to kick off the whole chain.

3) I create a second automator script that triggers the "Max" job. Like the "Sam" job, create a "Run Applescript" workflow:

tell application "SuperDuper!"
run using settings "/Users/ixnayus/Library/Application Support/SuperDuper!/Saved Settings/Backup Max to MyBook.sdsp" without user interaction
end tell

Save this in ~/Library/Application Support/SuperDuper!/Saved Settings as "SuperDuper Max to MyBook.app"

4) Open TextEdit and write "open " and then drag "SuperDuper Max to MyBook.app" onto it. You'll get a long command:

open /Users/ixnayus/Library/Application\ Support/SuperDuper\!/Saved\ Settings/SuperDuper\ Max\ to\ MyBook.app

Save this as a shell script: "Backup Max to MyBook.sh"

5) Here's an important step. You need to set permissions on the shell script so SuperDuper can open it without complaining.
From the terminal:

chmod 777 ~/Library/Application\ Support/SuperDuper\!/Saved\ Settings/Backup\ Max\ to\ MyBook.sh"

6) We now have all the pieces of the puzzle. Let's put it together. In SuperDuper!, open the "Sam" backup script. Click on the Options button. Click on Advanced. Check "Run shell script after copy completes" and navigate to the shell script you created in #4 above. Under "General" make sure "Do nothing" (default) is still selected under "On successful completion." Save the job.

7) Open the "Max" job in SuperDuper. Click "Options" then "General" and select "Sleep Computer" under "On successful completion". Save the job.


You now have an automator script that fires off a chain of events resulting in your backed up data and a sleepy computer.

Automator Backup Sam ->
SuperDuper Backup Sam ->
Shell - Open Automator Backup Max ->
SuperDuper Backup Max ->
Sleep computer


TIP: if you have Growl installed (http://growl.info/), you'll be greeted with a quick message when you start your computer up on whether the jobs completed successfully or not.


I hope this helps. Thanks, Dave, for pointing me in the right direction.

dnanian
06-21-2009, 10:03 AM
The only problem here is that you've run two jobs but only one can run at a time - and "run using settings" does not block. If you set things up as in the FAQ, and run the little program rather than directly running the settings, you'll leverage our "schedule driver", which knows how to queue the jobs, mount and unmount drives, etc.

ixnayus
06-21-2009, 03:51 PM
The only problem here is that you've run two jobs but only one can run at a time - and "run using settings" does not block. If you set things up as in the FAQ, and run the little program rather than directly running the settings, you'll leverage our "schedule driver", which knows how to queue the jobs, mount and unmount drives, etc.

But the jobs aren't running concurrently, they're running sequentially. Automator triggers the first job which fires off the shell script triggering the second job once it's done. It worked for me, but maybe that was a fluke.

To do as the FAQ instructs, you'd replace my step #3 with the instructions in the faq...

http://tinyurl.com/ljv8pz

... and point the shell script to the resulting app from the FAQ instead of the automator "Max" job in my example step #4.