Jump to content

[SOLVED] Workflow question. How do I unmount a network drive before Shut Down?


howdytom

Recommended Posts

Hi there,

 

I am trying to create a workflow that unmounts a AFP network volume before Shut Down. I am using diskutil unmount command. Here's my workflow which doesn't seem to correct. When I execute diskutil unmount on the command line, the volume is unmounted successfully. Can anyone help me out with this?

 

Alfred-Workflow-unmount-networkdrive.png.6421260beee66f56f7688c7f548545fd.png

 

Language: bin/bash

diskutil unmount /Volumes/myvolume

 

Alfred-Workflow-unmount-networkdrive2.png.77e1ebaab64fb6fe66db9d754443c9b3.png

Edited by howdytom
Solved
Link to comment

Welcome @howdytom,

 

When asking for help with a Workflow, please always upload the actual Workflow somewhere and post it. We can’t properly help you without access to it.


Debugging can already be hard with access to the code, and it’s even harder from just a description and screenshots. There are multiple places where the code or Workflow setup may be going wrong. Without looking at it we’re shooting in the dark.


Read the Reporting Problems with Workflows topic, as it gives a nice overview on how to build an effective report.

 



All that said, the problem might be diskutil returning from the command before the volume is unmounted. So diskutil sends the command and says “alright, the message was sent successfully, now the rest is up to the system, I’ll let the rest of the script continue”. To test this, try adding a delay between sending the command to unmount and the shutdown, by either adding a sleep 5 (or however many seconds you deem necessary) or an Alfred Delay Utility.

Link to comment
5 minutes ago, vitor said:

Can you be a bit more specific about what doesn’t work? Can you activate the Keyword and then it doesn’t unmount but it does shutdown, or what happens?


I see the Keyword has a required argument. Why?


Are you sure the name of your volume is correct?

 

You're right. There's no specific reason why the Keyword has a required argument. I've simply used the predefined setting.  Good news - It's working. The network volume is successfully unmounted when I select Keyword --> no Argument. Excellent. Thank you, Vitor.

Link to comment

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...