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

Go Back   Shirt Pocket Discussions > SuperDuper! > General

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 11-27-2006, 04:30 PM
michael.green michael.green is offline
Registered User
 
Join Date: Nov 2006
Posts: 14
Unmount share after copy

One of the tasks I use SD! for is daily copies of my user directory to a SimpleShare NAS. I have seven sparseimage files. Each one is updated on its day of the week in the middle of the night.

My question is: what is the preferred way to unmount the share after SD! is done?

I know that SD! unmounts the relevant sparseimage file. But the share is still mounted and I would like an automatic way of unmounting that.

Thanks!
Reply With Quote
  #2  
Old 11-27-2006, 05:35 PM
dnanian's Avatar
dnanian dnanian is offline
Administrator
 
Join Date: Apr 2001
Location: Weston, MA
Posts: 14,844
Send a message via AIM to dnanian
You could try to either modify the "schedule driver" (inside the application package) to do it, or write a little shell script that tosses an event into the background, waits 20 seconds or so and then unmounts...
__________________
--Dave Nanian
Reply With Quote
  #3  
Old 11-28-2006, 02:45 AM
michael.green michael.green is offline
Registered User
 
Join Date: Nov 2006
Posts: 14
I need a little more hand holding, I'm afraid.

Here's the shell script I have (name: unmountTheShare)
#!/bin/sh
sleep 20
umount /Volumes/TheShare

Here's the error I get in SD!'s Phase 3:
| 10:31:36 PM | Info | ...ACTION: Running shell script unmountTheShare
| 10:31:36 PM | Info | ......COMMAND => Invoking After Copy shell script: /Users/michaelgreen/Library/Scripts/unmountTheShare
| 10:33:36 PM | Error | umount: unmount(/Volumes/TheShare): Resource busy

I see what the problem is. SD! hasn't unmounted the sparseimage file yet.

I gather I'm missing the 'event tossed into the background'. But I don't know how to do that, that is, toss an event into the background. I assume it's just ... one ... more ... line.

Thanks again.
Reply With Quote
  #4  
Old 11-28-2006, 12:51 PM
dnanian's Avatar
dnanian dnanian is offline
Administrator
 
Join Date: Apr 2001
Location: Weston, MA
Posts: 14,844
Send a message via AIM to dnanian
Something like this:

Code:
#!/bin/sh
nohup /bin/bash -c "sleep 20; diskutil unmount /Volumes/TheShare" &
__________________
--Dave Nanian
Reply With Quote
  #5  
Old 12-09-2006, 01:56 AM
michael.green michael.green is offline
Registered User
 
Join Date: Nov 2006
Posts: 14
Thanks for the suggestion. SD! no longer gives me an error, but the share remains mounted.

Looking up diskutil in an edition of Mac OS X in a Nutshell (for 10.2), I see it says that diskutil needs to run with "special permissions". Perhaps that's what's amiss. Changing my account, the one that SD! runs under, to administrator doesn't seem to do the trick, though.

Does it have to run as root? And, if so, how do I make that happen?

Is there something else I should look into as a diagnostic matter?

Thanks again for all your help.
Reply With Quote
  #6  
Old 12-09-2006, 10:14 AM
dnanian's Avatar
dnanian dnanian is offline
Administrator
 
Join Date: Apr 2001
Location: Weston, MA
Posts: 14,844
Send a message via AIM to dnanian
No, it's already running with escalated permissions. Does your drive perhaps have a space in its name or something like that? Check the Console to see if there are any errors.
__________________
--Dave Nanian
Reply With Quote
  #7  
Old 12-09-2006, 12:05 PM
michael.green michael.green is offline
Registered User
 
Join Date: Nov 2006
Posts: 14
I kept the generic "SimpleShare" for the drive name.

Would capitalization matter? For the Finder's Connect to Server dialog, everything is lowercase (smb://simpleshare/mjg/). But in the sidebar area, the share is MJG. (I tried running the script manually, using BBEdit's "run script" menu entry, with it spelled both "mjg" and "MJG" but that didn't seem to make a difference, for what it's worth.)

SD! runs at 11:47 every night. Here's what look like relevant console messages from around that time for the past three nights. One in particular looks to my very untrained eye as if it stands out:

mount_smbfs: spnego blob2principal error 1

Mac OS X Version 10.4.8 (Build 8L127)
2006-12-05 11:04:21 -0800
Dec 5 20:50:55 MJGsPowerBook configd[74]: SecKeychainFindGenericPassword err= -25308 ( =0xffff9d24, secErrStr=User interaction is not allowed. ) (current= Esmerelda)
Dec 5 23:45:07 MJGsPowerBook configd[74]: SecKeychainFindGenericPassword err= -25308 ( =0xffff9d24, secErrStr=User interaction is not allowed. ) (current= Esmerelda)
mount_smbfs: spnego blob2principal error 1

Dec 6 23:45:06 MJGsPowerBook configd[74]: SecKeychainFindGenericPassword err= -25308 ( =0xffff9d24, secErrStr=User interaction is not allowed. ) (current= Esmerelda)
mount_smbfs: spnego blob2principal error 1


Dec 7 23:45:07 MJGsPowerBook configd[74]: SecKeychainFindGenericPassword err= -25308 ( =0xffff9d24, secErrStr=User interaction is not allowed. ) (current= Esmerelda)
mount_smbfs: spnego blob2principal error 1
2006-12-07 23:52:15.970 SyncServer[10360] A Sync Server is already running on this computer, exiting process.
2006-12-07 23:56:59.698 Translator[10418] Invoked to sync conduit com.apple.Safari for entityNames: com.apple.bookmarks.Folder,com.apple.bookmarks.Boo kmark
2006-12-08 00:52:13.840 SyncServer[10639] A Sync Server is already running on this computer, exiting process.
2006-12-08 00:55:02.563 Translator[10642] Invoked to sync conduit com.apple.Safari for entityNames: com.apple.bookmarks.Folder,com.apple.bookmarks.Boo kmark
Dec 8 01:45:16 MJGsPowerBook DirectoryService[86]: SafeOpen::Call to netinfo_open was with argument domain name: .. and lasted 3 seconds while timeout was 3



2006-12-08 21:49:47.418 SyncServer[11060] A Sync Server is already running on this computer, exiting process.
2006-12-08 21:52:49.930 Translator[11071] Invoked to sync conduit com.apple.Safari for entityNames: com.apple.bookmarks.Folder,com.apple.bookmarks.Boo kmark
Dec 8 23:45:04 MJGsPowerBook configd[74]: SecKeychainFindGenericPassword err= -25308 ( =0xffff9d24, secErrStr=User interaction is not allowed. ) (current= Esmerelda)
mount_smbfs: spnego blob2principal error 1
2006-12-09 00:29:51.172 SyncServer[11511] A Sync Server is already running on this computer, exiting process.
2006-12-09 00:32:04.228 Translator[11516] Invoked to sync conduit com.apple.Safari for entityNames: com.apple.bookmarks.Folder,com.apple.bookmarks.Boo kmark
2006-12-09 01:29:53.317 SyncServer[11551] A Sync Server is already running on this computer, exiting process.
2006-12-09 01:31:51.339 Translator[11556] Invoked to sync conduit com.apple.Safari for entityNames: com.apple.bookmarks.Folder,com.apple.bookmarks.Boo kmark
2006-12-09 02:29:55.544 SyncServer[11592] A Sync Server is already running on this computer, exiting process.
2006-12-09 02:34:18.609 Translator[11598] Invoked to sync conduit com.apple.Safari for entityNames: com.apple.bookmarks.Folder,com.apple.bookmarks.Boo kmark
2006-12-09 03:29:54.964 SyncServer[11789] A Sync Server is already running on this computer, exiting process.
2006-12-09 03:30:18.523 Translator[11793] Invoked to sync conduit com.apple.Safari for entityNames: com.apple.bookmarks.Folder,com.apple.bookmarks.Boo kmark
2006-12-09 04:29:57.673 SyncServer[11828] A Sync Server is already running on this computer, exiting process.
2006-12-09 04:33:18.195 Translator[11837] Invoked to sync conduit com.apple.Safari for entityNames: com.apple.bookmarks.Folder,com.apple.bookmarks.Boo kmark
2006-12-09 05:29:59.800 SyncServer[11871] A Sync Server is already running on this computer, exiting process.
2006-12-09 05:34:58.018 Translator[11877] Invoked to sync conduit com.apple.Safari for entityNames: com.apple.bookmarks.Folder,com.apple.bookmarks.Boo kmark
2006-12-09 06:30:02.058 SyncServer[11910] A Sync Server is already running on this computer, exiting process.
2006-12-09 06:30:58.100 Translator[11915] Invoked to sync conduit com.apple.Safari for entityNames: com.apple.bookmarks.Folder,com.apple.bookmarks.Boo kmark
2006-12-09 07:30:04.444 SyncServer[11949] A Sync Server is already running on this computer, exiting process.
2006-12-09 07:31:55.123 Translator[11954] Invoked to sync conduit com.apple.Safari for entityNames: com.apple.bookmarks.Folder,com.apple.bookmarks.Boo kmark
Reply With Quote
  #8  
Old 12-09-2006, 12:16 PM
dnanian's Avatar
dnanian dnanian is offline
Administrator
 
Join Date: Apr 2001
Location: Weston, MA
Posts: 14,844
Send a message via AIM to dnanian
Capitalization would likely matter with the command, yes. What I'd suggest is running it yourself, in Terminal, until you get it to work as expected...
__________________
--Dave Nanian
Reply With Quote
  #9  
Old 12-09-2006, 10:32 PM
michael.green michael.green is offline
Registered User
 
Join Date: Nov 2006
Posts: 14
1. ls /Volumes reveals that it's "mjg", not "MJG"

2. Here's my testing procedure:
a. mount mjg using the Finder in my non-administrator account
b. login via Terminal to an administrator account.
c. sudo diskutil unmount /Volumes/mjg
d. I get a mini-manual for diskutil. (This happens if I use diskutil in the terminal in one of six ways -- (i) from my account, from an administrator account, (ii) using sudo first or (iii) not; and the same, only calling the volume "MJG".)
Disk Utility Tool
Usage: diskutil [mount(Disk)|unmount(Disk)|eject] <force>
[Mount Point|Disk Identifier|Device Node]
Mount, unmount or eject local disks or volumes.
force is only valid on unmount or unmountDisk.
Example: diskutil unmount /Volumes/SomeDisk
3. diskutil list doesn't produce anything that looks like the volume I'm trying to unmount. It's 135 GB in size.
/dev/disk0
#: type name size identifier
0: Apple_partition_scheme *55.9 GB disk0
1: Apple_partition_map 31.5 KB disk0s1
2: Apple_Driver43 28.0 KB disk0s2
3: Apple_Driver43 28.0 KB disk0s3
4: Apple_Driver_ATA 28.0 KB disk0s4
5: Apple_Driver_ATA 28.0 KB disk0s5
6: Apple_FWDriver 256.0 KB disk0s6
7: Apple_Driver_IOKit 256.0 KB disk0s7
8: Apple_Patches 256.0 KB disk0s8
9: Apple_HFS Themistocles 55.9 GB disk0s9
4. The graphical application Disk Utility, doesn't show mjg, either in my account or the administrator account. In other words, I couldn't unmount the volume using the graphical application if I tried.

5. Do points 2-4 add up to the following: diskutil doesn't see the volume I'm trying to unmount using diskutil? If so, I can see why there would be a problem.

Thanks. I hope I'm not being too dense. But I am learning a few things along the way ... I think.
Reply With Quote
  #10  
Old 12-10-2006, 01:26 AM
dnanian's Avatar
dnanian dnanian is offline
Administrator
 
Join Date: Apr 2001
Location: Weston, MA
Posts: 14,844
Send a message via AIM to dnanian
Try "eject" instead of "unmount" and see if that works.
__________________
--Dave Nanian
Reply With Quote
  #11  
Old 12-10-2006, 12:35 PM
michael.green michael.green is offline
Registered User
 
Join Date: Nov 2006
Posts: 14
No luck. I logged in via the terminal to the administrator account and tried:

1. sudo eject /Volumes/mjg
2. sudo eject /Volumes/MJG
3. sudo unmount force /Volumes/mjg
4. sudo unmount force /Volumes/MJG
5. sudo eject force /Volumes/mjg
6. sudo eject force /Volumes/MJG

Each time, I got the same mini-manual for diskutil

NB: the volume "mjg" was mounted by SD! last night. Don't know if that makes a difference or not.

Thanks, as always.
Reply With Quote
  #12  
Old 12-10-2006, 12:41 PM
dnanian's Avatar
dnanian dnanian is offline
Administrator
 
Join Date: Apr 2001
Location: Weston, MA
Posts: 14,844
Send a message via AIM to dnanian
OK. My mistake: diskutil will only eject local volumes. This is a network mount. So, try:

Code:
#!/bin/sh
osascript <<77
tell application "Finder" to eject "the-volume-name"
77
__________________
--Dave Nanian
Reply With Quote
  #13  
Old 12-10-2006, 03:12 PM
michael.green michael.green is offline
Registered User
 
Join Date: Nov 2006
Posts: 14
And away the share goes! That did the trick. Yay!

Let me see if I understand (a) what happened and (b) what has to be done next.

(a) What happened?
(i) osascript = we're sending something to a program other than the shell. Applescript and the Finder, I think.
(ii) <<77 = we're starting here, 77 is a delimiter
(iii) tell the Finder to eject the volume -- that's what we want the other programs to do.
(iv) 77 = the other delimiter; that's the end of what we're sending to the other program.

(b) Now what comes next? We need to:
(i) wait for 20 seconds or so
(ii) run in the background.
So ...

Code:
#!/bin/sh
sleep 20
osascript <<77
tell application "Finder" to eject "mjg"
77
The second line waits for 20 seconds; that works in my testing. Task (b)(i) done.

But (b)(ii) is stumping me. Putting & or bg in various parts of this script produces errors. If I had to guess (and I do), it's that there should be something between the 77s that accomplishes this. But neither my books nor the internet is helping much.
Reply With Quote
  #14  
Old 12-10-2006, 05:36 PM
dnanian's Avatar
dnanian dnanian is offline
Administrator
 
Join Date: Apr 2001
Location: Weston, MA
Posts: 14,844
Send a message via AIM to dnanian
I think you'll now be able to do this with a single line, since the mini-script worked, the tricky thing being escaping things properly, and I couldn't figure it out. So put the eject in a little saved script:

Code:
tell application "Finder" to eject "mjg"
save as text or a compiled script, and do:

Code:
#!/bin/sh
nohup /bin/bash -c "sleep 20; osascript path/to/the/script/file" &
__________________
--Dave Nanian

Last edited by dnanian; 12-10-2006 at 05:51 PM. Reason: Corrected syntax
Reply With Quote
  #15  
Old 12-10-2006, 07:13 PM
michael.green michael.green is offline
Registered User
 
Join Date: Nov 2006
Posts: 14
Looks like we have a winner. I just ran Sunday's SD! job, took a walk, and came back to see SD! is done and the share is unmounted.

Thanks a million. There was no way I was going to hit on that on my own.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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
Booting from backup guruuno General 27 10-17-2009 12:53 AM
SD! & HDD copy speed fun DaleMeyn General 3 03-20-2006 05:24 PM
Copy error and crash offdahook84 General 3 10-01-2005 11:10 PM
BackUp hangs at 3% JimK General 10 09-27-2005 10:48 AM
Error: No space left on device tradervic General 11 06-29-2005 05:50 PM


All times are GMT -4. The time now is 01:36 PM.


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