Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

noone

macrumors 6502
Original poster
Feb 4, 2006
304
514
I have a Synology NAS that I'd like to have auto-mount upon login or wake up. I've tried doing it via a Login Item but it seems to try to connect before the network is ready and causes an error. Plus it would error out any time we're not on our home wifi network.

I had the idea of creating a Shortcut to check the wifi network and if it's our home network, waiting 5-10 seconds, then mounting the drive. I think I have the logic of it down in the shortcuts but... it just won't work. The closest I've come is getting a username/password prompt but it won't accept the credentials even though they are correct and I can mount it via Finder without issue.

Does anyone have any ideas/suggestions? I've never used Shortcuts before and this seems like it should be fairly straightforward but...nope.
 
I have a shortcut that mounts all my network drives using the Run Applescript action. Here's the script I use to mount them.

Code:
on run {input, parameters}
    tell application "Finder"
        if not (disk "DriveName1" exists) then
            mount volume "smb://username:password@ipaddr/DriveName1"
        end if
        if not (disk "DriveName2" exists) then
            mount volume "smb://username:password@ipaddr/DriveName2"
        end if
    end tell
    return input
end run

I don't have mine run on startup but you can add the Get Network Details action to check for your wifi network name and then run the AppleScript action inside an If block.

To have the shortcut run on startup, select the shortcut inside the Shortcuts app, click File in the menu bar and select Add to Dock. This will create a stand-lone "App" that you can add to your login items. Right click on the dock icon and select Show in Finder to locate your "App". It should be inside ~/Applications. Dock icon can be removed after you add it to your login items.
 
  • Like
Reactions: Crash0veride
To have the shortcut run on startup, select the shortcut inside the Shortcuts app, click File in the menu bar and select Add to Dock. This will create a stand-lone "App" that you can add to your login items. Right click on the dock icon and select Show in Finder to locate your "App". It should be inside ~/Applications. Dock icon can be removed after you add it to your login items.
Super neat trick to know.

I don't know how you would make a shortcut run from wake/sleep without another app.

Not quite what OP is looking for (and way beyond the scope of the question) but I use the app controlPlane (not actively developed) to create "contexts" to mount my Synology NAS drives when certain conditions are met, regardless of wake/sleep login. I use have a custom IP subnet at home and use it to detect if I'm home and connected to my wifi. The app is a bit convoluted and not actively developed anymore, but I forked it and compiled a build with the features I use working fine on Monterey: https://github.com/crash0verride11/ControlPlane You could hypothetically set it to launch your shortcut (as an app like kyc's suggestion) on lid open/close or sleep/wake.
 
Last edited:
Try Automounter, works great.
I'll have to check that out. Normally I hate paying for something that I can do myself, but I may just cave on this one. Saving $16 isn't worth the time or effort it would take me to get it working myself.
 
Try Automounter, works great.

I can also heavily recommend:


Similar to Automounter and it’s free. Good support from the developer. I moved to this one when Automounter was late with their Catalina support.
 
I simply mount the drive the first time, using SMB or AFS, as appropriate. Then I make an Alias of the mounted drive (Click once on drive, hold down CMD+OPT, drag left to create icon).
Then, when you need the drive, double click on it and it will mount.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.