View Full Version : Mounting an external volume before backup
chabig
12-04-2005, 04:09 PM
I'm using SD 2.0.1. I keep an external drive attached, but unmounted. I wrote a small Applescript to mount the backup volume and I set the advanced options to run that script before beginning the backup. However, SD doesn't see the backup volume at launch so it never starts the backup, thus is never mounts the volume, so it can't start the backup, etc.
How do I get out of this circle?
Chris
dnanian
12-04-2005, 04:42 PM
If you're doing this scheduled, Control-click the settings package in the Scheduled Copies folder (in Library/Application Support/SuperDuper!). Then edit the Copy Job.applescript you find in there. Add your commands to mount/unmount to the documented areas at the top of the script.
Save the script file, then go into SD! Uncheck and re-check the schedule checkbox (Edit the schedule). That'll re-compile the script for you, and you should be all set.
chabig
12-04-2005, 09:22 PM
Thanks Dave,
I thought there was an applescript interface somewhere, yet I am embarrassed to say I couldn't find it.
Chris
dnanian
12-04-2005, 09:23 PM
No problem, Chris. We're trying to decide if it makes sense to put in a button (or something) to expose the script for advanced users... but in the meantime going in the package will work, and should make you feel even more advanced! ;)
Syzygies
01-15-2006, 09:48 AM
I wrote a small Applescript to mount the backup volume
Does anyone have some sample code for this they'd like to share?
I have only seen code that makes Unix calls, referencing partitions using "disk0s10" and such. These descriptors aren't stable from boot to boot. They could work for years for one person, but fail on the first reboot for someone else. (This also comes up in moving swapfiles.)
Thanks,
Dave
dnanian
01-15-2006, 10:33 AM
The first solution in this thread (http://www.shirt-pocket.com/forums/showthread.php?t=235) users the drive name, not the device ID, and should work just fine.
bethri
05-01-2006, 05:57 AM
Dave: for example, using this code as suggested:
property diskname : "G5Backup"
tell application "Finder"
if not (exists the disk diskname) then
do shell script "diskutil mount `disktool -l | grep 'G5Backup' | sed 's/.*\\(disk[0-9s]*\\).*/\\1/'`"
delay 1
end if
end tell
delay 2
gives me errors about multiple run handlers or top-level commands wherever in the script I try to place it.
Ben
dnanian
05-01-2006, 07:57 AM
Sure: that's because you need to put it *inside* the "on before" or "on after" handler, as appropriate, not at the top level (outside any on block).
bethri
05-01-2006, 09:58 AM
That's what I figured (and tried) but:
on beforeRunningCopy()
-- Put your own code here that should execute just before running the copy.
-- Inserted to mount clone (G5Backup) before copying
Property diskname : "G5Backup"
tell application "Finder"
if not (exists the disk diskname) then
do shell script "diskutil mount `disktool -l | grep 'G5Backup' | sed 's/.*\\(disk[0-9s]*\\).*/\\1/'`"
delay 1
end if
end tell
delay 2
-- End of insertion
end beforeRunningCopy
gives me, 'Expected “end” but found “property”.' when I try to compile. Sorry I can't fix this myself but with my limited knowledge of Applescript, I can't see how to change this...
dnanian
05-01-2006, 10:46 AM
I'd suggest the following. Get rid of the Property, then:
beforeRunningCopy()
-- Put your own code here that should execute just before running
the copy.
tell application "Finder"
if not (exists the disk "G5Backup") then
try
do shell script "diskutil mount `disktool -l | grep 'G5Backup' | sed 's/.*\\(disk[0-9s]*\\).*/\\1/'`"
end try
repeat while not (exists the disk "G5Backup")
delay 1
end repeat
end if
end tell
end beforeRunningCopy
bethri
05-01-2006, 03:44 PM
That's perfect, thanks Dave. I've got it scheduled now, so I'll check the log tomorrow, and here's hoping.
Many thanks, Ben
dnanian
05-01-2006, 04:10 PM
You can always set it to schedule for "a minute from now" so you can test without waiting overnight! :-)
vBulletin® v3.8.9, Copyright ©2000-2024, vBulletin Solutions, Inc.