Shirt Pocket Discussions

Shirt Pocket Discussions (https://www.shirt-pocket.com/forums/index.php)
-   General (https://www.shirt-pocket.com/forums/forumdisplay.php?f=6)
-   -   Need to eject both source/destination when SD completes (https://www.shirt-pocket.com/forums/showthread.php?t=7082)

brilor 10-31-2017 01:35 PM

Need to eject both source/destination when SD completes
 
My goal is to eject both the Source and Destination external disks after an SD backup completes. Currently "scheduled copies" are used and work well. The option "On successful completion" provides an option for ejecting the destination disk but not the source. Presumably, I need to write a shell script to accomplish my goal(?) and hoped someone might have already done this since I'm not proficient with scripts. TIA and thanks for SD! Brian

dnanian 10-31-2017 01:41 PM

You'd have to write a "on successful completion" shell script that ejected the volume in the background, well after the run finishes. Something like:

Code:

#!/bin/bash
(nohup sleep 30;diskutil eject $2) &

(Note I didn't test that and just typed it in, so I could even have the syntax wrong, but hopefully you get the idea.)

brilor 11-06-2017 12:23 PM

FWIW: writing and implementing a script consisted of the following( YMMV since my situation is simple ):

1. Enter these commands in a text file ( used BBEdit but any text editor should be fine )
diskutil unmount /Volumes/myVolumeName1
diskutil unmount /Volumes/myVolumeName2

2. Save the file with a .sh extension

3. Issue a 'chmod +x' command on the text file to make it executable.

4. Within SD, go to the "Options" "Advanced" tab and designate the shell script to run in the "After copy" section.

Works great.

Thanks for the nudge Dave.

dnanian 11-06-2017 01:41 PM

In general, you really don't want to:

- Hardwire the names of the volumes here (they're passed in for you)
- Issue this while the copy is not complete, which is why I suggested waiting and doing it in the background

But, of course, it's up to you!


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

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