PDA

View Full Version : Automatically connect to network drive on startup, wake up, and other ups.




Nigel123
Aug 31, 2013, 11:46 PM
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.



Weaselboy
Sep 1, 2013, 05:10 PM
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.

Nigel123
Sep 4, 2013, 09:52 PM
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".

Weaselboy
Sep 5, 2013, 10:27 AM
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.

delay 30
tell application "Finder"
try
mount volume "smb://Network/NAS/Media"
end try
end tell

AndrewSBreck
Dec 7, 2013, 10:48 AM
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}

dimme
Dec 8, 2013, 07:38 AM
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?

moez
Dec 28, 2013, 01:55 PM
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?