more automounting samba drives in os x
I promised someone I'd post on this, and finally I have!
I've given up on the original method of mounting samba/cfs shares that I used to use, as it didn't really handle it well when those drives weren't available... Had to reboot to get them to remount etc, and we renamed some shares on different devices (server, NAS etc) to all be unique, so no more hassle with confusion over what is mounted at any one time.
So... I've gone with a two-prong approach:
- written a simple applescript to mount my drives where I want them
- using an app called MarcoPolo to automatically fire the script when it decides I'm at 'home'
Part 1: The script
Part 2: MarcoPolo
Also, it doesn't matter if the drives are already mounted, and you try to re-mount them - smbmount doesn't mind at all :)
I've given up on the original method of mounting samba/cfs shares that I used to use, as it didn't really handle it well when those drives weren't available... Had to reboot to get them to remount etc, and we renamed some shares on different devices (server, NAS etc) to all be unique, so no more hassle with confusion over what is mounted at any one time.
So... I've gone with a two-prong approach:
- written a simple applescript to mount my drives where I want them
- using an app called MarcoPolo to automatically fire the script when it decides I'm at 'home'
Part 1: The script
- Fire up ScriptEditor
- Drop in the following for each drive (this example is for SMB shares):
try
tell application "Finder"
mount volume "smb://username:password@server/share"
end tell
end try - Put in username/password/server/share as needed
- Repeat for each drive (if you want them to mount under the same MarcoPolo 'location')
- Save as an application somewhere out of the way (ie your home dir) - I used the settings in this image:
- Try it out - double click the new app and check it mounts everything correctly. Your system.log (available in the console app) should tell you if there's anything wrong.
- Add a nice icon if you want, as it will flash in your dock until the script completes.
Part 2: MarcoPolo
- Download MarcoPolo from the developers website, or your fav tracker site
- Install
- Set up a 'home' context - Set up whatever rules define your 'home' - for me, I've got set the IP rule (as I have a reserved IP on the router, so it's always the same when I'm connected to the home router), and also the WiFi rule, so it triggers when I connect to our home router
- Set up an action against your home rule to run the mount script
Also, it doesn't matter if the drives are already mounted, and you try to re-mount them - smbmount doesn't mind at all :)
I hope you will find a way to mount after waking up from sleep mode
ReplyDelete