automatically mount network share

Discussion in 'macOS' started by WizardFusion, Jun 6, 2009.

  1. WizardFusion macrumors newbie

    Joined:
    Apr 28, 2008
    #1
    I have a windows share that is mounted on my mac, with various folders aliased around the place - Movies, Music, etc. All for Front Row. This works great, but if I need to take my windows server down for a long time the mount disappears, and Front Row no longer works until I manually browse to the folder and it re-mounts.

    Is there any way I can get my mac to automatically search for and mount my share.?

    Also, are alias the best way for me to do this.?

    Thanks.
     
  2. WizardFusion thread starter macrumors newbie

    Joined:
    Apr 28, 2008
    #3
    Thanks, I have had a play with applescript before, but couldn't get it working.

    I am after something that will work in the background and automatically mount the share.

    I generally use my mac without a keyboard and mouse as its connected to my TV.
     
  3. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #4
    Well, if you can get it to work via AppleScript then you could save it as an app then add it to the login items. That wouldn't help when there's a disconnect after login, but a step in the right direction. The alternative would be to write something like a bash script to do the mounting and have it setup on a cron job that runs every so often and does any mounting that's necessary.

    (from, http://www.ozzu.com/macintosh-forum/mac-osx-auto-mount-user-network-drive-t68618.html)
    Code:
    #!/bin/bash
    mkdir /Volumes/<Share Name>
    /sbin/mount -t smb smb://username:password@172.0.0.0/<Share Name> /Volumes/<Share Name>
    You'll have to fill in the <Share Name> and the proper IP or network name. The script will also need execution permissions. From Terminal,
    Code:
    chmod u+x path/to/script
    You could then add this script to a cron job. You can find crontab tutorials pretty easily if you don't know how to set them up.

    There's a remote network mapping discussion here that gives this,
    Code:
    mount_afp -i "afp:test:password!@fil262@company.com/Photo" /volumes/Photo
    That way you could run it from another Mac if that's an option for you.

    Hope some of this is of help. Losing mounts is something Apple could really improve upon. There's been plenty of discussions about people wanting it to remember mounts.
     
  4. WizardFusion thread starter macrumors newbie

    Joined:
    Apr 28, 2008
  5. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #6
    Your welcome. For completeness of the thread, and for others who find their way here, would you mind posting the specific solution you settled on?
     
  6. techfreak85 macrumors 68040

    techfreak85

    Joined:
    Jan 13, 2008
    Location:
    Places
    #7
    or even easier, connect to the share in Finder.
    go into System preferences>Accounts>your account>login items>+ Sign>Find the network share/folder in the slide down chooser thingy.
    this way it will mount on login. If you have the password in the key chain, it will mount with out prompt. if you dont, when you log in, it will ask for user name and password.
     
  7. WizardFusion thread starter macrumors newbie

    Joined:
    Apr 28, 2008
    #8
    I would, but I need to have a play first.!
    I am happy with programming and scripting, but a novice with Macs.!
    I think the best solution would be a cron job as you say, but with a script that mounts the volume rather than one that tells finder to open it. That way you don't have a finder window opening every 10 minutes.! :)
     

Share This Page