Mount network drives on demand

Discussion in 'macOS' started by Sesshi, Dec 10, 2006.

  1. Sesshi macrumors G3

    Sesshi

    Joined:
    Jun 3, 2006
    Location:
    One Nation Under Gordon
    #1
    What's the best way of going about this? For example, iTunes needs to access a network shared drive but the Mac has not been explicitly connected to the drive in question. I need it to mount the drive automatically if it is accessible.
     
  2. terriyaki macrumors 6502a

    Joined:
    Aug 4, 2005
    Location:
    Vancouver
    #2
    Make a script and just fire it up in Quicksilver whenever you please.
     
  3. Sesshi thread starter macrumors G3

    Sesshi

    Joined:
    Jun 3, 2006
    Location:
    One Nation Under Gordon
    #3
    In which case I can just double-click on the shortcut. If the share exists, I need OS X to reconnect automatically - it's a fairly basic and important requirement.
     
  4. mad jew Moderator emeritus

    mad jew

    Joined:
    Apr 3, 2004
    Location:
    Adelaide, Australia
    #4
    Can you get it to simply connect at login instead, or is the problem that it gets disconnected and needs to be maintained? :)
     
  5. Queso macrumors G4

    Joined:
    Mar 4, 2006
    #5
    Have the script map the drive then open iTunes, then rather than click to open iTunes, click to run the script.
     
  6. Sesshi thread starter macrumors G3

    Sesshi

    Joined:
    Jun 3, 2006
    Location:
    One Nation Under Gordon
    #6
    Yes. Let me give you a typical situation:

    Windows - I have Drives Z, X, Y and S mapped to different shared folders on servers / NASs. Some of these may be accessible or not depending on where I am but if an app launches that needs access to those network drives they will automatically try and connect, then give me an error if it doesn't exist. If the share is accessible, it will of course connect.

    The Mac loses connections to network drives that are not accessible, when it sleeps and any number of other seeming reasons, and they have to be re-connected manually. It cannot be an app-specific script-triggered action because that will be unworkable.
     
  7. iMeowbot macrumors G3

    iMeowbot

    Joined:
    Aug 30, 2003
    #7
    DAVE does what I think you're asking for. They have a handy dandy chart with the differences between their product and vanilla OS X.
     
  8. Sesshi thread starter macrumors G3

    Sesshi

    Joined:
    Jun 3, 2006
    Location:
    One Nation Under Gordon
    #8
    Looks like it. I was meaning to pick it up in any case as my Macs were incapable of talking to anything else but the NAS and each other, thanks. I'll buy it now.
     
  9. Sesshi thread starter macrumors G3

    Sesshi

    Joined:
    Jun 3, 2006
    Location:
    One Nation Under Gordon
    #9
    Mmkay, Dave chokes on my NASs. The QNAP TS-101 and the Thecus N5200 both generate authentication errors. Connects to my W2003 box fine. Never simple, is it? Something about tss_check_cifs is not running.
     
  10. iMeowbot macrumors G3

    iMeowbot

    Joined:
    Aug 30, 2003
    #10
    I'd bounce that one off Thursby. That sounds a little like this issue with execute permissions, or something related.
     
  11. jeremy.king macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #11
    I'd suggest using Applescript to write a small app. Change the script icon to the application icon, and drop it in the dock instead of the original application.

    Code:
    tell application Finder
        mount volume "smb://username:password@someserver/sharename"
    end tell
    tell application iTunes to activate
    
    or something like that. I'll try when I get home. If you leave the username/password out, it will prompt you.
     
  12. tyr2 macrumors 6502a

    tyr2

    Joined:
    May 6, 2006
    Location:
    Leeds, UK
    #12
    This was published in SysAdmin Mag a while back it'll automount the share on demand. I used it for my iTunes library when it used to be on a samba share. It kinda assumes you know what you're doing in the terminal tho:

    1 - Make sure fstab is in sync with the current NetInfo settings by running:
    nidump fstab . >> /etc/fstab

    2 - Edit fstab to include a line similar to the following
    server:/share /Network/Servers url url==smb://user:password@server/share,net 0 0

    (that should say user : password above, i couldn't get it to turn the smilies off)
    Replace 'server', 'share', 'user' and 'password' with the required settings

    3 - Load new fstab into NetInfo
    niload fstab . < /etc/fstab

    4 - Reboot and find the volume available under /Network/Servers/server/share

    5 - Repoint iTunes if necessary and you're done.
     
  13. Sesshi thread starter macrumors G3

    Sesshi

    Joined:
    Jun 3, 2006
    Location:
    One Nation Under Gordon
    #13
    @king - as I said earlier, it is not just for one app so redocking each app is not workable.

    @tyr2 - I get it. It might work for me although it's a faff. I'll give it a try.
     
  14. jeremy.king macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #14
    Seriously? It takes about a minute to write and save the Applescript, so even if you had 10 apps its very workable...I am guessing its your iLife apps, so I don't see the issue...

    tyr2, do you know the behaviour if the Volume is not available?
     

Share This Page