Automatically connect to network drive on startup, wake up, and other ups. - MacRumors Forums
Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > OS X > Mac OS X Server, Xserve, and Networking

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 31, 2013, 11:46 PM   #1
Nigel123
macrumors newbie
 
Join Date: Oct 2012
Automatically connect to network drive on startup, wake up, and other ups.

Heya!

So I just set up a network hard drive for my family so that we can access files from any computer, or watch movies from the TV without any need to plug and swap each connection.

My issue is the initial connection to the HDD on start up, wake ups, and other reestablishments with the network.

I've looked into the issue and found many many solutions that don't work. What my problem is the way my HDD establishes connection with the router. It's slow. Takes about 1-2 minutes, while the computers take less that 30 seconds.

What is occurring is the computer starts up and goes, "Oh network isn't available," and then doesn't try to connect.

I found this guide: http://superuser.com/a/303011 but I don't really understand it. I've used terminal before, but after I enter the first line I don't see what should come next.

So what I'm really asking: Is there a way in OSX ML to automatically connect to a network HDD when it sees it is ready, rather than try and connect when it is clearly not available.

Additionally, please avoid "Leave the HDD and router on all the time" because that is not how we roll and if it were this question wouldn't be posed.
Nigel123 is offline   0 Reply With Quote
Old Sep 1, 2013, 05:10 PM   #2
Weaselboy
macrumors G5
 
Weaselboy's Avatar
 
Join Date: Jan 2005
We should be able to fix you up with an Applescript to mount the drive then put a delay XX command at the beginning of the script to delay it running.

What is the path to the network drive and I'll try and help you with the Applescript.
Weaselboy is offline   0 Reply With Quote
Old Sep 4, 2013, 09:52 PM   #3
Nigel123
Thread Starter
macrumors newbie
 
Join Date: Oct 2012
Sorry I took so long!

Quote:
Originally Posted by Weaselboy View Post
We should be able to fix you up with an Applescript to mount the drive then put a delay XX command at the beginning of the script to delay it running.

What is the path to the network drive and I'll try and help you with the Applescript.
I wasnt notified and got busy to check here!

It's located at: /Network/NAS/Media

My concern is that is this script going to run only at login or will it always detect if the drive is online?

I would like it to be.. okay imagine you have a macbook, router, and nas hard drive. The power goes out, the macbook is fine because of battery, the router and has go out. Then the power comes on, you automatically reconnect to the router because your macbook is constantly checking for that connectivity. The hard drive however, is offline. My preference would be for it to say, "Oh I see the hard drive connected to the router I'll automatically connect" to "Oh it's offline I'll try and connect to see if it was interrupted" to "Oh it's definitely offline, no response" to hours later when it is online, "Oh I see it connected now, I'll list it in the connected severs".
Nigel123 is offline   0 Reply With Quote
Old Sep 5, 2013, 10:27 AM   #4
Weaselboy
macrumors G5
 
Weaselboy's Avatar
 
Join Date: Jan 2005
Quote:
Originally Posted by Nigel123 View Post
I wasnt notified and got busy to check here!

It's located at: /Network/NAS/Media

My concern is that is this script going to run only at login or will it always detect if the drive is online?

I would like it to be.. okay imagine you have a macbook, router, and nas hard drive. The power goes out, the macbook is fine because of battery, the router and has go out. Then the power comes on, you automatically reconnect to the router because your macbook is constantly checking for that connectivity. The hard drive however, is offline. My preference would be for it to say, "Oh I see the hard drive connected to the router I'll automatically connect" to "Oh it's offline I'll try and connect to see if it was interrupted" to "Oh it's definitely offline, no response" to hours later when it is online, "Oh I see it connected now, I'll list it in the connected severs".
Paste this into the Applescript Editor app and save it as an application, then add it to your login items. This will launch the script at login and delay 30 seconds before mounting the NAS drive. You can test it in Applescript Editor first to see if you need to extend the 30 seconds.

Also, manually mount the drive and select it in Finder then do a command-i and look at the path to make sure it matches the section in quotes.

This should get you the delay you want at startup.

As far as making sure the drive stays mounted, that is a bit more complex. OS X has a utility called autofs that can be used to monitor networked drive and remount them. I am only slightly familiar with it... so you will need to research how to cobble together that piece yourself.

Code:
delay 30
tell application "Finder"
	try
		mount volume "smb://Network/NAS/Media"
	end try
end tell
Weaselboy is offline   0 Reply With Quote
Old Dec 7, 2013, 10:48 AM   #5
AndrewSBreck
macrumors newbie
 
Join Date: Dec 2013
Bump

Anyone built something like this?
I have a network server at home, and all I want is for it to automatically connect if it is available.

so basically:
if ({Volume} isAvailable && !Connected)
connect to {Volume}
AndrewSBreck is offline   0 Reply With Quote
Old Dec 8, 2013, 07:38 AM   #6
dimme
macrumors 6502a
 
Join Date: Feb 2007
Location: SF, CA
When I startup my mac I also want to connect to my network drive. I just added it to the login items and it is always there. Now if you are having a problem because you share is not available right away, perhaps we should work on that problem. I use a mini server with a attached drive and the volumes are always available. So is you nas always available to the network?
__________________
dimme is offline   0 Reply With Quote
Old Dec 28, 2013, 01:55 PM   #7
moez
macrumors regular
 
Join Date: Jun 2007
Quote:
Originally Posted by AndrewSBreck View Post
Anyone built something like this?
I have a network server at home, and all I want is for it to automatically connect if it is available.

so basically:
if ({Volume} isAvailable && !Connected)
connect to {Volume}
Did you figure out how to do it?
moez is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > OS X > Mac OS X Server, Xserve, and Networking

Tags
nas, network, router, terminal, wireless

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Not Automatically connecting to Network on startup ? stuartrozier Mac Pro 2 Jun 2, 2013 04:08 PM
Mac won't automatically connect to network NikkiJayne OS X 10.8 Mountain Lion 3 Dec 11, 2012 06:15 AM
Will my iPhone 4S automatically connect to 4G after network upgrade? Rodney2009 iPhone 16 Oct 25, 2012 03:42 PM
Automatically mounting a network drive (SMB) when connecting to the network Flore Mac OS X 10.7 Lion 2 Sep 15, 2012 06:34 PM
Automatically connect to strongest open network? (possibly AppleScript?) GavWhite OS X 0 Aug 2, 2012 03:53 PM

Forum Jump

All times are GMT -5. The time now is 09:27 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC