|03-06-2006, 10:29 AM||#1|
Join Date: Sep 2004
Auto Mounting Network Drive After Sleep
Is it possible to auto mount a network drive upon waking up? I know you can auto mount a network drive on startup / login by putting it in the startup items, but if you put your Mac to sleep, the drive goes away once you wake it up.
|07-30-2008, 11:23 PM||#4|
Join Date: Jul 2008
Here's a way to nearly auto mount
You can fully automate it if you can kick off a script at wake up time. (I haven't looked into that yet.)
Thanks to BDAqua on discussions.apple.com for the most important first part of this.
Once you get the drives on the desktop, just get aliases to them, and then use those aliases to reconnect to the drives as a quick shortcut. And then you can use an Automator script to automate this, so a double-click on a desktop item opens all your needed drives instantly
Here are the details.
1. Get the items on your desktop by connecting to the drives.
2. If you only have one (or few) you can drag it (them) to your dock, adjacent to the trash can.
3. Or, you can make an automation script that you can stick on your desktop or in the dock...
4. First, create a folder such as "Shares" in a convenient or an out of the way place. (You will only need to access it when you place new drives in it, and once in creation of the script.)
5. Drag the mounted drives into the "Shares" folder. OS X will make aliases there.
6. At this point, you can eject the mounted drives, and "opening" (say, by double-clicking) the drive aliases, and the drives will re-appear.
7. We can use this to make an Automator script.
8. Open Automator from its place in the Applications folder, or by getting it from Spotlight.
9. In the leftmost panel, "Library", select Finder to narrow the options.
10. In the Action panel, to the right, grab "Get Specified Finder Items" to the righmost panel.
11. Drag the folder you created earlier called "Shares", into the open area for "Get Specified Finder Items" in the rigtmost panel.
12. Drag "Get Folder Contents" from the Action panel into the open space below "Get Specified Finder Items" in the rightmost panel.
13. Drag "Open Finder Items" from the Action panel into the open area under "Get Folder Contents" in the rightmost panel.
14. You can test it by ejecting the drives (if they are open), and clicking the Run button in Automator.
15. If the drives show up on the desktop again, you're set.
16. First save it normally, as a Workflow, so you can edit it later if need be: In Automator, choose File->Save, and name it something like OpenShares Workflow.
17. Now save it as an application - choose: File->Save As..., and change File Format: from Workflow to Application. You can name it whatever you like. Mine's called OpenPCShares, and I saved this one to my desktop. You can even drag this to the dock (the left side) anywhere you like.
18. You can be done, but for a nice finishing touch, I liked changing the icon from the Automator Robot to the network icon. You can do this by connecting to a drive and doing Get Info on it, then click the *little* network icon at the top left, and select Edit->Copy. (If you can't copy, you didn't pick the right icon.) Then do a Get Info on the Automator script you created, and click the little Automator icon - again, top left, and then do Edit->Paste. Close everything up, and your done. Just try it out.
19. Oh, if you want to add drives later, just drag them into the Shares folder you created earlier. The script looks for the contents of the folder.
This was developed and tested in OS X 10.4.11.
|10-23-2009, 10:35 AM||#5|
Join Date: Oct 2009
Real automount in (Snow) Leopard with autofs
I know this thread is old, but this is still high on Google for searching MacOSXHints for automounting a network share when waking from sleep. And there are other threads about using a sleepwatching service to run an applescript... ugh.
I did a lot more digging. Here's what I think must be the Right Way. In Leopard or Snow Leopard. Add a line to /etc/auto_master like:
then create a file /etc/auto_afp like:
/Volumes/MyShare -fstype=afp afp://MyNetworkComputer.local/MyShare
Give this file the same permissions auto_master had. Then run sudo automount -vc. You're done. Your share is just always there, and it always works. Yay!
This should work with smb instead of afp just fine, I imagine. Look up Apple's "Technical White Paper" Autofs.pdf for all the details.
|03-25-2013, 11:58 PM||#6|
Join Date: Mar 2013
Sorry for bumping up this old thread.
The method in schneck's last post still worked on Mountain Lion.
Thanks a lot for the info.
The only problem for me is that my afp volume (which is a TimeCaplsule) is password authenticated, and I feel somewhat uneasy writing down the password explicitly in "/etc/auto_afp", like so:
/Volumes/MyShare -fstype=afp afp://usernameassword@MyNetworkComputer.local/MyShare
Would there be any work-around for this, e.g. using Apple's Keychain in the process?
|Display Modes||Rate This Thread|