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
Old Sep 5, 2014, 09:48 AM   #8
CJM
macrumors 6502a
 
CJM's Avatar
 
Join Date: May 2005
Location: U.K.
Thread necro, yay! After some Googling I found this thread. Would love to be able to do what was mentioned here:

if ({Volume} isAvailable && !Connected)
connect to {Volume}

I have my Time Machine disk image on a network drive, which requires manual mounting every time I'm in the office. Obviously, I forget quite often, leading to weeks between backups. Is this doable via Applescript? I have an alias of the disk image on my desktop, so it's simply a matter of mounting it when the network share is available.

I last touched Applescript on Mac OS 10.1, to write some silly prank back in my teens. I have no idea what I'm doing.
__________________
iPad 3 64GB / iPhone 5 32GB
MacBook Air 2013 13" / i5 / 8GB RAM / 256 SSD
6-core 5820k @ 4.6GHz / Rampage V Extreme / Windforce GTX 780 / 16GB DDR4 / 512 Samsung 850 Pro / Custom loop / LG 34"UM95
CJM is offline   0 Reply With Quote
Old Sep 5, 2014, 10:04 AM   #9
dfausty
macrumors 6502
 
Join Date: Jul 2014
Location: You are here [*]
Itís not an automated solution, but it is pretty simple to remount the drive using Finder.

I have a public share on my Drobo-FS named "Public". To set it up to reconnect, do the following:

Open Finder.
Press CMD-K.
Enter the smb path in the dialog box (smb://Drobo-FS/Public).
Click the + button to add it to the list of devices.
Click the [Connect] button.

Now, when the drive gets unmounted, re-mounting is a simple as opening Finder and pressing CMD-K [enter]
Attached Thumbnails
Click image for larger version

Name:	Screen Shot 2014-09-05 at 8.00.20 AM.png
Views:	29
Size:	96.2 KB
ID:	488824  
__________________
Tech Geek Apple Freak Freelance Curmudgeon Runs With Scissors
dfausty is offline   0 Reply With Quote
Old Sep 5, 2014, 11:19 AM   #10
mvmanolov
macrumors 6502a
 
Join Date: Aug 2013
Quote:
Originally Posted by CJM View Post
Thread necro, yay! After some Googling I found this thread. Would love to be able to do what was mentioned here:

if ({Volume} isAvailable && !Connected)
connect to {Volume}

I have my Time Machine disk image on a network drive, which requires manual mounting every time I'm in the office. Obviously, I forget quite often, leading to weeks between backups. Is this doable via Applescript? I have an alias of the disk image on my desktop, so it's simply a matter of mounting it when the network share is available.

I last touched Applescript on Mac OS 10.1, to write some silly prank back in my teens. I have no idea what I'm doing.
You could automator to make a app that will automatically connect at login...
Pause (3sec)
get specified server
connect to server
done
__________________
| 2014 13" rMBP i5 | 2013 13" MBA i7 | 2012 Mac Mini i7 | 2012 13" MBP i5 | 2008 13" MB c2d | 2006 iMac c2d | iPad Air | iPad 3 | iPhone 6 | iPhone 5 | iPhone 4S | iPhone 4 | iPhone 3 |
mvmanolov is offline   0 Reply With Quote
Old Sep 6, 2014, 04:30 AM   #11
CJM
macrumors 6502a
 
CJM's Avatar
 
Join Date: May 2005
Location: U.K.
Quote:
Originally Posted by mvmanolov View Post
You could automator to make a app that will automatically connect at login...
Pause (3sec)
get specified server
connect to server
done
As a login app only, or can it be executed when entering password after waking from sleep? I don't really turn off my laptop.
__________________
iPad 3 64GB / iPhone 5 32GB
MacBook Air 2013 13" / i5 / 8GB RAM / 256 SSD
6-core 5820k @ 4.6GHz / Rampage V Extreme / Windforce GTX 780 / 16GB DDR4 / 512 Samsung 850 Pro / Custom loop / LG 34"UM95
CJM is offline   0 Reply With Quote
Old Sep 6, 2014, 06:29 AM   #12
mvmanolov
macrumors 6502a
 
Join Date: Aug 2013
Quote:
Originally Posted by CJM View Post
As a login app only, or can it be executed when entering password after waking from sleep? I don't really turn off my laptop.
well, automator is quite powerful, so you may be able to do that. for example you can make the same app as a "service" and then create a "workflow" that will do that.... i may try this myself actually. LOL (though in the interest of full disclosure, i'm by no means an automator expert...)
__________________
| 2014 13" rMBP i5 | 2013 13" MBA i7 | 2012 Mac Mini i7 | 2012 13" MBP i5 | 2008 13" MB c2d | 2006 iMac c2d | iPad Air | iPad 3 | iPhone 6 | iPhone 5 | iPhone 4S | iPhone 4 | iPhone 3 |
mvmanolov 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 04:37 PM.

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

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