![]() |
|||||||||||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
#1
|
|||
|
|||
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! |
#2
|
||||
|
||||
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 |
#3
|
|||
|
|||
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. |
#4
|
||||
|
||||
Something like this:
Code:
#!/bin/sh nohup /bin/bash -c "sleep 20; diskutil unmount /Volumes/TheShare" &
__________________
--Dave Nanian |
#5
|
|||
|
|||
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. |
#6
|
||||
|
||||
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 |
#7
|
|||
|
|||
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 |
#8
|
||||
|
||||
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 |
#9
|
|||
|
|||
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 Tool3. diskutil list doesn't produce anything that looks like the volume I'm trying to unmount. It's 135 GB in size. /dev/disk04. 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. |
#10
|
||||
|
||||
Try "eject" instead of "unmount" and see if that works.
__________________
--Dave Nanian |
#11
|
|||
|
|||
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. |
#12
|
||||
|
||||
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 |
#13
|
|||
|
|||
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 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. |
#14
|
||||
|
||||
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" 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 04:51 PM. Reason: Corrected syntax |
#15
|
|||
|
|||
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. |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Booting from backup | guruuno | General | 27 | 10-16-2009 11:53 PM |
SD! & HDD copy speed fun | DaleMeyn | General | 3 | 03-20-2006 04:24 PM |
Copy error and crash | offdahook84 | General | 3 | 10-01-2005 10:10 PM |
BackUp hangs at 3% | JimK | General | 10 | 09-27-2005 09:48 AM |
Error: No space left on device | tradervic | General | 11 | 06-29-2005 04:50 PM |