Jump to content

Workflow for ejecting external drive


Recommended Posts

I have an external drive that I only use for an app-specific task (recording audio).

The drive is located in a semi-incovenient place so I sometimes forget to unplug it when I'm done.

Is there a workflow I can create to eject the external disc when I close the app?

Thanks!

Link to comment

Connect a Keyword (or whatever trigger you prefer) to a Run Script Action with Language set to /bin/bash. Set the code to:

open --wait-apps -a 'APP'
diskutil eject '/Volumes/DISK'


Replace APP with your app’s name (e.g. Safari) and DISK with your drive’s name. If you don’t know the drive’s name, open a terminal and run ls /Volumes with it connected.


You still need to run the Workflow for it to eject the drive after the app closes, but it doesn’t matter if the app was open at the time or not.


On a tangential note, when asking for help, it helps us help you if you’re as specific as possible. For example, instead of saying “I have an app”, tell us what the app is. More often than not, those details matter.

Link to comment
1 minute ago, vitor said:

 


On a tangential note, when asking for help, it helps us help you if you’re as specific as possible. For example, instead of saying “I have an app”, tell us what the app is. More often than not, those details matter.

Thank you Vitor.  Apologies for not being specific.  Don't know if it matters at this point but the app is Reaper (Cockos).  It's a DAW for music and audio.

Link to comment
  • vitor changed the title to [SOLVED] Workflow for ejecting external drive
  • 4 months later...

Been using this workflow since @vitor provided it but now it's launching the app a SECOND time when I use this workflow.

For instance, I'll already have a workflow that I use to open some sites and apps which include Reaper (DAW).

Here:

main workflow

 

That workflow will launch everything just fine. I'll do my work and midway through I will do the 'Eject Disk' Workflow, seen here:

Eject Workflow

 

But when I do the 'Eject' workflow it will launch 'Reaper' again and I'll have 2 windows for Reaper open.

 

Any idea what went wrong here?

 

Thanks

Link to comment
  • 10 months later...
On 6/11/2019 at 9:01 AM, vitor said:

Connect a Keyword (or whatever trigger you prefer) to a Run Script Action with Language set to /bin/bash. Set the code to:


open --wait-apps -a 'APP'
diskutil eject '/Volumes/DISK'

 


Replace APP with your app’s name (e.g. Safari) and DISK with your drive’s name. If you don’t know the drive’s name, open a terminal and run ls /Volumes with it connected.

 

So I need to close 2 external hard drives with this.  Can I just add "eject 'Volumes/DISK2?"

Link to comment
1 hour ago, lazermoose said:

I posted about needing to eject an external hard drive here but it has been marked 'solved' but I need to eject MORE THAN 1 external drive now

 

Then unmark it solved? At any rate, please don't create another thread. That one isn't locked.

 

I'm merging this thread with that one.

Link to comment
  • deanishe changed the title to Workflow for ejecting external drive

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...