View Single Post
  #7  
Old 10-08-2005, 04:53 PM
edoates edoates is offline
Registered User
 
Join Date: Jul 2005
Posts: 44
Backup script to dismount images

Here is my full backup script. At the top, it opens the SuperDuper ".sds" file which will start SuperDuper and cause it to load those setting and mount the destination disks if not already mounted.. I saved those setting manually after setting up the backup options I wanted (the correct source and destination disks, the backup options (smart, etc.), and a post backup script to disable spotlight).

Then Superduper is told to quit, and I've added to the script to eject the backup disk and then to compact it (it is a sparse image).

I've created scripts for each of my backups and schedule them to run with Cronnix.

The script:

tell application "Finder"
activate
open document file "Backup Music.sds" of folder "Saved Settings" of folder "SuperDuper!" of folder "Application Support" of folder "Library" of folder "edoates" of folder "Users" of startup disk
end tell
tell application "SuperDuper!"
try
--Wait until SuperDuper! is idle before loading and running the desired session
repeat while status is not idle
--Sleep # seconds is the best way to "wait" without using the CPU
tell application "System Events" to do shell script "sleep 5"
end repeat
if status is idle then
--Specify the saved settings as either an absolute path or just the name
run using settings "Backup Music" without user interaction
end if
--Wait until the session is done
repeat while status is running
--Sleep # seconds is the best way to "wait" without using the CPU
tell application "System Events" to do shell script "sleep 5"
end repeat
on error errMsg
display dialog errMsg & " See section 12 of the User's Guide for help with this script."
end try
--Once done, tell SuperDuper! to quit
quit
end tell
-- Tell Finder to eject the backup set
tell application "Finder"
activate
eject disk "Music Backups"
end tell
activate
display dialog "Awaiting dismount of Music Backups" buttons {"OK"} giving up after 5 default button 1
-- compact the sparse image to prevent unregulated growth
do shell script "hdiutil compact " & "\"/Volumes/Eds Office Backups/Music Backups.sparseimage\""
activate
display dialog "Music Backup Complete" buttons {"OK"} giving up after 30 default button 1

-- end of script

Hope this is useful

Last edited by edoates; 10-08-2005 at 04:56 PM. Reason: Correct typo
Reply With Quote