Shirt Pocket Discussions  
    Home netTunes launchTunes SuperDuper! Buy Now Support Discussions About Shirt Pocket    

Go Back   Shirt Pocket Discussions > SuperDuper! > General
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-15-2006, 05:20 PM
MarkW19 MarkW19 is offline
Registered User
 
Join Date: Mar 2006
Posts: 19
Scripts

As I've got a seperate backup partition (as I'm sure most of us have), I don't really want this mounting on the desktop all the time.

Is there a way to do a script or something, so that when SD starts it's scheduled backup, it mounts my backup partition, does the backup, and then unmounts it afterwards (and sends my computer to sleep as normal)?
Reply With Quote
  #2  
Old 03-15-2006, 06:09 PM
dnanian's Avatar
dnanian dnanian is offline
Administrator
 
Join Date: Apr 2001
Location: Weston, MA
Posts: 14,923
Send a message via AIM to dnanian
There are number of suggested scripts and the like that do that elsewhere on the forum, Mark. Have a look around and you should find something to your liking.
__________________
--Dave Nanian
Reply With Quote
  #3  
Old 03-15-2006, 06:36 PM
MarkW19 MarkW19 is offline
Registered User
 
Join Date: Mar 2006
Posts: 19
Thanks Dave.
Reply With Quote
  #4  
Old 03-15-2006, 07:24 PM
MarkW19 MarkW19 is offline
Registered User
 
Join Date: Mar 2006
Posts: 19
OK, I've had a good look around, and I've played around with some scripts to get one that actually complies ok with no errors.

I thought this one would work, but it doesn't. Can anyone tell me where I've gone wrong? The partition I want to mount is called Backup, and according to Disk Utility it's disk identifier is disk0s5, so I put that into the script...

=====
-- SuperDuper! scheduled copy script template (c) 2005-2006 by Bruce Lacey. Published by Shirt Pocket.
-- Script by Dave Nanian and Bruce Lacey

on beforeRunningCopy()
tell application "Finder"
if not (exists the disk Backup) then
do shell script "diskutil mount `disktool -l | grep 'Backup' | sed 's/.*\\(disk0s5*\\).*/\\1/'`"
delay 1
end if
end tell

delay 2
end beforeRunningCopy

on afterRunningCopy()
tell application "Finder"
if (exists the disk "Backup") then
eject "Backup"
delay 2
end if
end tell

delay 2
end afterRunningCopy
Reply With Quote
  #5  
Old 03-15-2006, 08:26 PM
dnanian's Avatar
dnanian dnanian is offline
Administrator
 
Join Date: Apr 2001
Location: Weston, MA
Posts: 14,923
Send a message via AIM to dnanian
Well, Mark, if you know it's disk0s5 already, and you're basically locking it down to that device ID in your expression, there's no point doing the while disktool -l bit. Instead, to see if it works, just do a mount of disk0s5:

do shell script "diskutil mount disk0s5"
__________________
--Dave Nanian
Reply With Quote
  #6  
Old 03-16-2006, 07:28 AM
MarkW19 MarkW19 is offline
Registered User
 
Join Date: Mar 2006
Posts: 19
I've done diskutil mount disk0s5, and diskutil unmount disk0s5 in terminal, and both work perfectly.

However, my script doesn't appear to work (it won't mount Backup if it's not already mounted):-

on beforeRunningCopy()
tell application "Finder"
if not (exists the disk Backup) then
do shell script "diskutil mount disk0s5"
delay 1
end if
end tell

delay 2
end beforeRunningCopy

on afterRunningCopy()
tell application "Finder"
if (exists the disk "Backup") then
eject "Backup"
delay 2
end if
end tell

delay 2
end afterRunningCopy

What am I doing wrong?
Reply With Quote
  #7  
Old 03-16-2006, 08:16 AM
Cuneyt Cuneyt is offline
Registered User
 
Join Date: Sep 2005
Location: Istanbul, Turkey
Posts: 33
beforeRunningCopy() and afterRunningCopy() are subroutines and subroutines don't run unless you tell them to run in the script.
Reply With Quote
  #8  
Old 03-16-2006, 08:19 AM
MarkW19 MarkW19 is offline
Registered User
 
Join Date: Mar 2006
Posts: 19
How do I tell them to run in the script?
Reply With Quote
  #9  
Old 03-16-2006, 08:24 AM
Cuneyt Cuneyt is offline
Registered User
 
Join Date: Sep 2005
Location: Istanbul, Turkey
Posts: 33
insert a beforeRunningCopy() line where you want that subroutine to run.
Reply With Quote
  #10  
Old 03-16-2006, 08:52 AM
dnanian's Avatar
dnanian dnanian is offline
Administrator
 
Join Date: Apr 2001
Location: Weston, MA
Posts: 14,923
Send a message via AIM to dnanian
I'm assuming this script is actually part of your scheduled item, and you didn't delete the rest of it (hopefully). If you did remove the rest, then Cuneyt is right: the script doesn't do anything, because there's nothing calling those routines.
__________________
--Dave Nanian
Reply With Quote
  #11  
Old 03-16-2006, 01:16 PM
MarkW19 MarkW19 is offline
Registered User
 
Join Date: Mar 2006
Posts: 19
I haven't deleted the rest of it, I just pasted the relevant parts here

I'll give it a shot now...
Reply With Quote
  #12  
Old 03-16-2006, 01:19 PM
dnanian's Avatar
dnanian dnanian is offline
Administrator
 
Join Date: Apr 2001
Location: Weston, MA
Posts: 14,923
Send a message via AIM to dnanian
That's what I thought!

It might be worthwhile actually running the script outside of SD! (without the SD! parts) to see what it does in a controlled environment.
__________________
--Dave Nanian
Reply With Quote
  #13  
Old 03-16-2006, 01:25 PM
MarkW19 MarkW19 is offline
Registered User
 
Join Date: Mar 2006
Posts: 19
OK it still doesn't do anything, as you may have guessed I've no experience whatsoever with scripting!!

How do I modify this so it works:-

-- SuperDuper! scheduled copy script template (c) 2005-2006 by Bruce Lacey. Published by Shirt Pocket.
-- Script by Dave Nanian and Bruce Lacey

on beforeRunningCopy()
tell application "Finder"
if not (exists the disk Backup) then
do shell script "diskutil mount disk0s5"
delay 1
end if
end tell

delay 2
beforeRunningCopy()
end beforeRunningCopy

on afterRunningCopy()
tell application "Finder"
if (exists the disk "Backup") then
eject "Backup"
delay 2
end if
end tell

delay 2
afterRunningCopy()
end afterRunningCopy
Reply With Quote
  #14  
Old 03-16-2006, 01:26 PM
MarkW19 MarkW19 is offline
Registered User
 
Join Date: Mar 2006
Posts: 19
Where do I insert the "beforeRunningCopy()" and "afterRunningCopy()" to ensure they both work?
Reply With Quote
  #15  
Old 03-16-2006, 04:50 PM
MarkW19 MarkW19 is offline
Registered User
 
Join Date: Mar 2006
Posts: 19
Anybody? :P
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Run Shell Scripts cucciasv General 1 02-26-2006 09:31 PM
Partitioning & Bu Strategy & scripts MacMedix General 1 09-19-2005 09:09 PM
Scheduled SU backups edoates General 2 07-27-2005 06:53 PM
What does Edit > Show All Copy Scripts do? (seriously) Darkside General 3 05-12-2005 11:01 AM
Questions about "exclude system cache/temporary files" Copy Scripts Darkside General 1 05-12-2005 09:48 AM


All times are GMT -4. The time now is 09:07 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2024, vBulletin Solutions, Inc.