Newbie on Mac OS X - HOW DO I AUTO MOUNT SHARES

Please post anything pertaining to Mac and OS X compatibility issues here.

Re: Newbie on Mac OS X - HOW DO I AUTO MOUNT SHARES

Postby alex » Sun Oct 05, 2008 12:56 pm

In the search field, just type 'get specified servers' and add it as an action. Then click Add.. to enter the shares you want. Then, search for 'connect to servers' and add that:

Image

You can also choose to add you username and password here by entering afp://user:pass@server/share instead.
alex
ReadyNAS Newbie
 
Posts: 24
Joined: Wed Mar 01, 2006 3:51 am
Location: Amsterdam, the Netherlands

Re: Newbie on Mac OS X - HOW DO I AUTO MOUNT SHARES

Postby SLIDERROMAN » Sun Oct 05, 2008 2:11 pm

Thanks, I'll give it a shot.
SLIDERROMAN
ReadyNAS User
 
Posts: 74
Joined: Thu Jun 12, 2008 11:30 am

Re: Newbie on Mac OS X - HOW DO I AUTO MOUNT SHARES

Postby SLIDERROMAN » Sun Oct 05, 2008 3:30 pm

WORKS GREAT THANKS :D :D :D :D :D :D
SLIDERROMAN
ReadyNAS User
 
Posts: 74
Joined: Thu Jun 12, 2008 11:30 am

Re: Newbie on Mac OS X - HOW DO I AUTO MOUNT SHARES

Postby bigboy » Sat Oct 11, 2008 3:30 pm

There's a blog posting on autofs that might be helpful. I haven't tried it out though.

http://rajeev.name/blog/2007/11/22/auto ... 05-part-i/
bigboy
ReadyNAS Newbie
 
Posts: 28
Joined: Sat Oct 11, 2008 3:26 pm

Re: Newbie on Mac OS X - HOW DO I AUTO MOUNT SHARES

Postby SLIDERROMAN » Sat Oct 11, 2008 4:24 pm

Thanks for the link, but I'm still very new with OS X (Unix). The only thing I would love to change is the following: I would love to know if there is a way to automatically set the Automator not to run if the Macbook is not connected to my home network. Any idea's out there?
SLIDERROMAN
ReadyNAS User
 
Posts: 74
Joined: Thu Jun 12, 2008 11:30 am

Re: Newbie on Mac OS X - HOW DO I AUTO MOUNT SHARES

Postby wardie » Thu Oct 30, 2008 4:28 pm

A different approach works for me fine. I wrote an Applescript like the below (in Script Editor), which does a ping to see if my NV+ box is up and if so then checks if a number of the AFP shares are mounted already, and mounts them if not. Looks like the below code. Replace the hostname "readynas" which whatever host name or IP address your NAS is, and replace the share names too to match your setup.
Then I compile and save it in Script Editor as an Application rather than a Script, and add the created Application to the login items as described by previous postings.

Code: Select all
if (do shell script "ping -c1 readynas") contains "1 packets received" then
   try
      if (list disks) does not contain "media" then
         mount volume "afp://readynas/media"
      end if
   end try
   
   try
      if (list disks) does not contain "shared" then
         mount volume "afp://readynas/shared"
      end if
   end try
end if

on quit
   continue quit
end quit

There is probably a more elegant way to check if the server is available using Applescript not running a shell ping, if anyone knows?
ReadyNAS NV+, 4x500GB Seagate ST3500630NS, RAIDiator 4.1.6, APC Back-UPS ES 700VA 230V UK
ReadyNAS Duo, 2x1TB Samsung HD103UJ, RAIDiator 4.1.6
wardie
ReadyNAS User
 
Posts: 68
Joined: Thu Aug 09, 2007 1:49 am
Location: London, UK
ReadyNAS: NV+

Re: Newbie on Mac OS X - HOW DO I AUTO MOUNT SHARES

Postby SLIDERROMAN » Thu Oct 30, 2008 5:30 pm

Hi wardie,

I tried your method and it did not work, see my script below:

What am I missing?

Do I need to replace something with the IP of my ReadyNas, or am I missing something else?



if (do shell script "ping -c1 readynas") contains "1 packets received" then
try
if (list disks) does not contain "Adult" then
mount volume "afp://readynas/Adult"
end if
end try

try
if (list disks) does not contain "Feature" then
mount volume "afp://readynas/Feature"
end if
end try
end if

on quit
continue quit
end quit



Thanks
SLIDERROMAN
ReadyNAS User
 
Posts: 74
Joined: Thu Jun 12, 2008 11:30 am

Re: Newbie on Mac OS X - HOW DO I AUTO MOUNT SHARES

Postby wardie » Fri Oct 31, 2008 8:30 am

Do I need to replace something with the IP of my ReadyNas, or am I missing something else?

Yes you need to replace the word "readynas" in the first line of code with either the hostname or IP address of your NAS box (which you can see from Frontview admin web site for your NAX box). My hostname happens to be "readynas", which I maintain a static mapping to an IP address in my /etc/hosts file (or whever that file is on my OS X machines, I've forgotton)... Typically its IP address would likely be somethnig like 192.168.1.NNN unless you've changed your local network domain.

Note that if you reference the IP address directly you may find in future that your script breaks as your NAX box may aquire a different IP address from your DHCP server (which is probably on your router). If you have a statically assigned IP address for your NAS box you will be OK. Suggest you read the Frontview documentation and some web resources on basic IP networking if you are stuck. There may be better ways to discover the NAX box and that it is up that the way I did it, but I'm not an expert in OS X.
ReadyNAS NV+, 4x500GB Seagate ST3500630NS, RAIDiator 4.1.6, APC Back-UPS ES 700VA 230V UK
ReadyNAS Duo, 2x1TB Samsung HD103UJ, RAIDiator 4.1.6
wardie
ReadyNAS User
 
Posts: 68
Joined: Thu Aug 09, 2007 1:49 am
Location: London, UK
ReadyNAS: NV+

Re: Newbie on Mac OS X - HOW DO I AUTO MOUNT SHARES

Postby SLIDERROMAN » Fri Oct 31, 2008 5:28 pm

I changed the script as follows:

if (do shell script "ping -c1 192.168.1.100") contains "1 packets received" then
try
if (list disks) does not contain "Adult" then
mount volume "afp://readynas/Adult"
end if
end try

try
if (list disks) does not contain "Feature" then
mount volume "afp://readynas/Feature"
end if
end try
end if

on quit
continue quit
end quit


Do I need to add anything else to the login items besides the script as an application?


Do I need to replace "readynas" with the IP every where?




Thanks
SLIDERROMAN
ReadyNAS User
 
Posts: 74
Joined: Thu Jun 12, 2008 11:30 am

Re: Newbie on Mac OS X - HOW DO I AUTO MOUNT SHARES

Postby wardie » Sat Nov 01, 2008 5:15 am

No and Yes respectively.
You can of course try the script out by directly running in Script Editor it before you make it an app and add it to login items.
ReadyNAS NV+, 4x500GB Seagate ST3500630NS, RAIDiator 4.1.6, APC Back-UPS ES 700VA 230V UK
ReadyNAS Duo, 2x1TB Samsung HD103UJ, RAIDiator 4.1.6
wardie
ReadyNAS User
 
Posts: 68
Joined: Thu Aug 09, 2007 1:49 am
Location: London, UK
ReadyNAS: NV+

Re: Newbie on Mac OS X - HOW DO I AUTO MOUNT SHARES

Postby lowfi » Mon Nov 03, 2008 12:43 pm

Code: Select all
mkdir /Volumes/Media; mount_afp afp://user:pass@10.0.0.2/Media /Volumes/Media


This works fast in terminal. But whenever i try to add it to launchd (using lingon) the share is not mounted.....

Why? automator is slow and sloppy imo
NV+ 4.1.4 256MB Jumbo, MacPro 3ghz 8GB Jumbo, Netgear GS105, Apple AEBS
lowfi
ReadyNAS User
 
Posts: 67
Joined: Wed Sep 26, 2007 11:42 am
Location: The Netherlands
ReadyNAS: NV+

Re: Newbie on Mac OS X - HOW DO I AUTO MOUNT SHARES

Postby schalliol » Sun Nov 09, 2008 1:18 pm

wardie, I appreciated your script. For those who wish to close windows after mounting, you can create a script (or add to another script) with the following line. This will close all finder windows, including other windows that might have been opened prior to launch:
Code: Select all
tell application "Finder" to close every window
ReadyNAS Ultra 4 Plus Seagate Constellation ES 2TB x 3 w/ APC Smart-UPS 750 w/ Webcard, HP ProCurve V1810 Switches, ReadyNAS NV+ Backup Unit 2TB x 3, Mac Pro 4x2.66 10/SSD 240GB RAID 0+4 Drive 3TB RAID 0/AE/BT, MBP 2.8 6/1 TB RAID 0 + EC SSD
User avatar
schalliol
ReadyNAS Expert
 
Posts: 348
Joined: Fri Nov 03, 2006 4:47 am
Location: Indianapolis, IN
ReadyNAS: Ultra

Re: Newbie on Mac OS X - HOW DO I AUTO MOUNT SHARES

Postby wardie » Sun Nov 09, 2008 2:25 pm

schalliol wrote:For those who wish to close windows after mounting, you can create a script (or add to another script) with the following line.
No problem. I have never suffered from any residual open windows, I'm guessing because when I save the App in Script Editor I uncheck both "Startup Screen" and "Stay Open" boxes, and also select "Hide" checkbox on the Login Items list. I haven't tested that to prove it though.
ReadyNAS NV+, 4x500GB Seagate ST3500630NS, RAIDiator 4.1.6, APC Back-UPS ES 700VA 230V UK
ReadyNAS Duo, 2x1TB Samsung HD103UJ, RAIDiator 4.1.6
wardie
ReadyNAS User
 
Posts: 68
Joined: Thu Aug 09, 2007 1:49 am
Location: London, UK
ReadyNAS: NV+

Re: Newbie on Mac OS X - HOW DO I AUTO MOUNT SHARES

Postby KillerBob » Tue Aug 11, 2009 11:02 am

Hi,

I have followed the script to the letter, and saved it as an Application. When I run it from the script editor all works fine. However, saved as an APL, and run from the desktop, or in the login items, it does not work???

The error is "Connection failed", and I only get this error (one time for every share) if I have any of the shares not already on the desktop.

My path to the shares is "afp://NASNAME (AFP)._afpovertcp._tcp.local/SHARENAME"

Thanks in advance for any suggestions...

KB
Mac Pro (2.8GHz 8C, 16GB RAM, 960GB Accelsior, 500GB SSD, 2x750GB RAID0) - MacBook Pro (15", 2.66GHz i7, 8GB RAM, 250GB SSD) - MacBook Pro (15", 2.53GHz, 8GB RAM, 250GB SSD) - MacBook Air (2GHz i7, 8GB RAM, 250GB SSD) - Mac Mini (2.3GHz, 8GB RAM, 500GB) - Pro Pioneer (3x3TB + 3x1TB) - Ultra 2 (2x3TB) - Time Capsule (3TB)
KillerBob
ReadyNAS Expert
 
Posts: 435
Joined: Sat Dec 09, 2006 10:41 am
ReadyNAS: Pro

Re: Newbie on Mac OS X - HOW DO I AUTO MOUNT SHARES

Postby Infinite » Sat Oct 23, 2010 7:41 pm

mattclark04 wrote:Or, for a more low-level/technically correct (i.e. avoiding finder/login hacks) approach, try opening a terminal and typing 'man automount' (though to be fair, these being UNIX help pages, that may not quite do the trick!)

I have the following in my /etc/fstab file:
# -------------------------------------------------------------------------------------
# Mount AFP shares from the ReadyNAS
# servername:/path mount_point url auto,url==afp://username:password@server/path 0 0
# -------------------------------------------------------------------------------------
forth.local:/music /Volumes/music url auto,url==afp://media:media@forth.local/music 0 0
forth.local:/music /Volumes/movies url auto,url==afp://media:media@forth.local/movies 0 0

Which makes /Volumes/music and /Volumes/movies automagically mount the relevant AFP shares. Then it's a simple matter of symlinking what dirs you want, such as 'ln -s /Volumes/movies ~/Movies'

OMG... I've been looking for this thread for EVER! I've failed to get this running for 4 years now! FINALLY I have it working using /etc/fstab.

I have added some addition information for folks that use the Guest account... which I should most likely move away from. Also many people will need to add '.local' to your servernames to get them to work. IE: MyReadyNas would be MyReadyNas.local

-Cheers!
i

Code: Select all
# -------------------------------------------------------------------------------------
# Mount AFP shares from the ReadyNAS
# -------------------------------------------------------------------------------------
# For account with User and Password
# servername:/path mount_point url auto,url==afp://username:password@server/path 0 0
#
# For Guest Account (with .local suffix example):
# servername.local:/mp3 /Volumes/mp3 url auto,url==afp://;AUTH=No%20User%20Authent@servername.local/mp3 0 0
# -------------------------------------------------------------------------------------

servername.local:/mp3 /Volumes/mp3 url auto,url==afp://;AUTH=No%20User%20Authent@servername.local/mp3 0 0
servername.local:/Media /Network/Media url auto,url==afp://;AUTHaH=No%20User%20Authent@servername.local/Media 0 0

# -------------------------------------------------------------------------------------
ReadyNas Pro, NV+, Duo
User avatar
Infinite
ReadyNAS User
 
Posts: 76
Joined: Thu Jan 04, 2007 10:25 pm
Location: Seattle, WA
ReadyNAS: Pro

Previous

Return to Mac / OS X



Who is online

Users browsing this forum: No registered users and 3 guests