I have a lot of digital music and movies. In fact, it’s at the point where I decided that I needed a home a media server because my external hard drive was just not cutting it anymore. I decided to build a Linux box running Xubuntu because of the versatility and stability Linux provides, and I found a how to article a few weeks back on Digg which outlined the entire process.

After the server was up and running I decided that I wanted my computer to auto-mount my Samba drive whenever I was at home. Using a combination of an AppleScript saved as an application and a free software for OS X, Home Zone, I was able to have my computer identify when I’m at home and only launch my Samba drive when I’m here.

Let’s get started:

The first thing I did was searched Google and found an AppleScript to mount my Samba drive. It can be downloaded as a .txt here (I can’t paste it into blogger b/c of errors).

After I replaced the server information with my own I saved the script as an application and dropped it into my applications folder. If I had a desktop I could just launch the script every time I booted my computer (system preferences -> accounts -> login items), but since I have a laptop I only wanted the drive to mount when I was at home where the drive is.

There are several free location automators for OS X and after trying a few I decided to use Home Zone because it was the easiest to configure:<ol>

  • Install and launch Home Zone
  • Click on the Home Zone icon in your menu bar and select "Configure"
  • In the "Zones" section click the plus arrow and name your new zone (Home in my case).
  • In the "Triggers" section click the plus arrow and select the following options:
    • When "all" of the following are available
    • Kind: "Airport Network"
    • Network: "Your wireless Network Name"
    • Check the "Only when connected" box
  • In the "Actions - Entering the Zone" section click the plus arrow. Use the following configuration:
    • Action: Open File
    • Drag the Samba mounting AppleScript into the space right below the action pull down menu (it should say "Drag any file here")

    </ol>That’s it…you’re done! Now anytime you are on your home network your samba drive will automount.