Feature request: Automount/Unmount

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Feature request: Automount/Unmount Fri Oct 21, 2016 10:48 am • by Pete248
First let me say Hazel is a great tool and I use it for a lot of things.

Today I wanted to add a presumable simple rule to Hazel: Move files of a special type to a folder on my NAS.

No problem, if the the share on the NAS is already mounted. It just works as with a local folder.
No problem either, if the share is not mounted and I'm fine, that the rule gets delayed until I mount the share.

But very difficult, if I want it happen immediately and keep the mounted/unmounted state of the share.

Yes, I could run a shell script to check, whether a /Volumes/sharename folder exists and mount it via shell script or Applescript, if not.

In addition to the hassle in having to deal with shell scripts / Applescripts, there are some hiccups:

1.) Ideally the script should run only before the first move action, afterwards the share is already mounted.
2.) Testing for the existence of a /Volumes/Sharename folder doesn't mean the correct share is mounted. I.e I often have a /Volumes/peter share mounted from another computer, when I've mounted my home folder from that machine.
3.) Ideally the share should be unmounted after the rule, but only if it was't already mounted before.

While there are other special usecases, this behavior is what people usually expect when moving files to a NAS with Hazel.

I'd like to see a checkbox "auto-mount/unmount" in the copy, move actions etc., whenever I choose a destination folder that is located on a network drive. When checked, Hazel should silently mount the correct network drive after the first match in case it is not already mounted and unmount it at the end of the rule in case it had mounted the network drive before. For AFP, SMB shares Hazel could rely on the keychain to do the authentication.

In case this goal can be reached with a workaround in the current version, I'd be happy to hear about.

Cheers

Pete
Pete248
 
Posts: 2
Joined: Mon Dec 07, 2015 6:16 am

Re: Feature request: Automount/Unmount Fri Oct 21, 2016 11:39 am • by Mr_Noodle
It's not really that straightforward how you describe it. For one, there's no notion of Hazel being "done". It just sees a stream of file changes and has no idea that this last change is "the last one". The best you can do is process things a whole folder at a time and use that as your operational unit.

Otherwise, something like this is better handled either via an automounter or script, where you can apply your logic to determine when the best times to mount/unmount are.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support